javax.activation.FileTypeMap Java Examples

The following examples show how to use javax.activation.FileTypeMap. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BinaryResourceDownloadMeta.java    From eplmp with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Get the Content type for this file
 *
 * @return Http Response content type
 */
public String getContentType() {
    String contentType;
    if (outputFormat != null) {
        contentType = FileTypeMap.getDefaultFileTypeMap().getContentType(fullName + "." + outputFormat);
    } else {
        contentType = FileTypeMap.getDefaultFileTypeMap().getContentType(fullName);
    }


    if (contentType != null && contentType.startsWith("text")) {
        contentType += ";charset=" + CHARSET;
    }

    return (contentType != null) ? contentType : "application/octet-stream";
}
 
Example #2
Source File: JavaMailSenderTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void javaMailSenderWithMimeMessageHelperAndSpecificEncoding() throws MessagingException {
	MockJavaMailSender sender = new MockJavaMailSender();
	sender.setHost("host");
	sender.setUsername("username");
	sender.setPassword("password");

	MimeMessageHelper message = new MimeMessageHelper(sender.createMimeMessage(), "UTF-8");
	assertEquals("UTF-8", message.getEncoding());
	FileTypeMap fileTypeMap = new ConfigurableMimeFileTypeMap();
	message.setFileTypeMap(fileTypeMap);
	assertEquals(fileTypeMap, message.getFileTypeMap());

	message.setTo("[email protected]");
	sender.send(message.getMimeMessage());

	assertEquals("host", sender.transport.getConnectedHost());
	assertEquals("username", sender.transport.getConnectedUsername());
	assertEquals("password", sender.transport.getConnectedPassword());
	assertTrue(sender.transport.isCloseCalled());
	assertEquals(1, sender.transport.getSentMessages().size());
	assertEquals(message.getMimeMessage(), sender.transport.getSentMessage(0));
}
 
Example #3
Source File: JavaMailSenderTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Test
public void javaMailSenderWithMimeMessageHelperAndDefaultEncoding() throws MessagingException {
	MockJavaMailSender sender = new MockJavaMailSender();
	sender.setHost("host");
	sender.setUsername("username");
	sender.setPassword("password");
	sender.setDefaultEncoding("UTF-8");

	FileTypeMap fileTypeMap = new ConfigurableMimeFileTypeMap();
	sender.setDefaultFileTypeMap(fileTypeMap);
	MimeMessageHelper message = new MimeMessageHelper(sender.createMimeMessage());
	assertEquals("UTF-8", message.getEncoding());
	assertEquals(fileTypeMap, message.getFileTypeMap());

	message.setTo("[email protected]");
	sender.send(message.getMimeMessage());

	assertEquals("host", sender.transport.getConnectedHost());
	assertEquals("username", sender.transport.getConnectedUsername());
	assertEquals("password", sender.transport.getConnectedPassword());
	assertTrue(sender.transport.isCloseCalled());
	assertEquals(1, sender.transport.getSentMessages().size());
	assertEquals(message.getMimeMessage(), sender.transport.getSentMessage(0));
}
 
Example #4
Source File: SimpleEmailServiceJavaMailSender.java    From spring-cloud-aws with Apache License 2.0 6 votes vote down vote up
@Override
public MimeMessage createMimeMessage() {

	// We have to use reflection as SmartMimeMessage is not package-private
	if (ClassUtils.isPresent(SMART_MIME_MESSAGE_CLASS_NAME,
			ClassUtils.getDefaultClassLoader())) {
		Class<?> smartMimeMessage = ClassUtils.resolveClassName(
				SMART_MIME_MESSAGE_CLASS_NAME, ClassUtils.getDefaultClassLoader());
		Constructor<?> constructor = ClassUtils.getConstructorIfAvailable(
				smartMimeMessage, Session.class, String.class, FileTypeMap.class);
		if (constructor != null) {
			Object mimeMessage = BeanUtils.instantiateClass(constructor, getSession(),
					this.defaultEncoding, this.defaultFileTypeMap);
			return (MimeMessage) mimeMessage;
		}
	}

	return new MimeMessage(getSession());
}
 
Example #5
Source File: JavaMailSenderTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void javaMailSenderWithMimeMessageHelperAndSpecificEncoding() throws MessagingException {
	MockJavaMailSender sender = new MockJavaMailSender();
	sender.setHost("host");
	sender.setUsername("username");
	sender.setPassword("password");

	MimeMessageHelper message = new MimeMessageHelper(sender.createMimeMessage(), "UTF-8");
	assertEquals("UTF-8", message.getEncoding());
	FileTypeMap fileTypeMap = new ConfigurableMimeFileTypeMap();
	message.setFileTypeMap(fileTypeMap);
	assertEquals(fileTypeMap, message.getFileTypeMap());

	message.setTo("[email protected]");
	sender.send(message.getMimeMessage());

	assertEquals("host", sender.transport.getConnectedHost());
	assertEquals("username", sender.transport.getConnectedUsername());
	assertEquals("password", sender.transport.getConnectedPassword());
	assertTrue(sender.transport.isCloseCalled());
	assertEquals(1, sender.transport.getSentMessages().size());
	assertEquals(message.getMimeMessage(), sender.transport.getSentMessage(0));
}
 
Example #6
Source File: JavaMailSenderTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void javaMailSenderWithMimeMessageHelperAndDefaultEncoding() throws MessagingException {
	MockJavaMailSender sender = new MockJavaMailSender();
	sender.setHost("host");
	sender.setUsername("username");
	sender.setPassword("password");
	sender.setDefaultEncoding("UTF-8");

	FileTypeMap fileTypeMap = new ConfigurableMimeFileTypeMap();
	sender.setDefaultFileTypeMap(fileTypeMap);
	MimeMessageHelper message = new MimeMessageHelper(sender.createMimeMessage());
	assertEquals("UTF-8", message.getEncoding());
	assertEquals(fileTypeMap, message.getFileTypeMap());

	message.setTo("[email protected]");
	sender.send(message.getMimeMessage());

	assertEquals("host", sender.transport.getConnectedHost());
	assertEquals("username", sender.transport.getConnectedUsername());
	assertEquals("password", sender.transport.getConnectedPassword());
	assertTrue(sender.transport.isCloseCalled());
	assertEquals(1, sender.transport.getSentMessages().size());
	assertEquals(message.getMimeMessage(), sender.transport.getSentMessage(0));
}
 
Example #7
Source File: JavaMailSenderTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void javaMailSenderWithMimeMessageHelperAndDefaultEncoding() throws MessagingException {
	MockJavaMailSender sender = new MockJavaMailSender();
	sender.setHost("host");
	sender.setUsername("username");
	sender.setPassword("password");
	sender.setDefaultEncoding("UTF-8");

	FileTypeMap fileTypeMap = new ConfigurableMimeFileTypeMap();
	sender.setDefaultFileTypeMap(fileTypeMap);
	MimeMessageHelper message = new MimeMessageHelper(sender.createMimeMessage());
	assertEquals("UTF-8", message.getEncoding());
	assertEquals(fileTypeMap, message.getFileTypeMap());

	message.setTo("[email protected]");
	sender.send(message.getMimeMessage());

	assertEquals("host", sender.transport.getConnectedHost());
	assertEquals("username", sender.transport.getConnectedUsername());
	assertEquals("password", sender.transport.getConnectedPassword());
	assertTrue(sender.transport.isCloseCalled());
	assertEquals(1, sender.transport.getSentMessages().size());
	assertEquals(message.getMimeMessage(), sender.transport.getSentMessage(0));
}
 
Example #8
Source File: JavaMailSenderTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Test
public void javaMailSenderWithMimeMessageHelperAndSpecificEncoding() throws MessagingException {
	MockJavaMailSender sender = new MockJavaMailSender();
	sender.setHost("host");
	sender.setUsername("username");
	sender.setPassword("password");

	MimeMessageHelper message = new MimeMessageHelper(sender.createMimeMessage(), "UTF-8");
	assertEquals("UTF-8", message.getEncoding());
	FileTypeMap fileTypeMap = new ConfigurableMimeFileTypeMap();
	message.setFileTypeMap(fileTypeMap);
	assertEquals(fileTypeMap, message.getFileTypeMap());

	message.setTo("[email protected]");
	sender.send(message.getMimeMessage());

	assertEquals("host", sender.transport.getConnectedHost());
	assertEquals("username", sender.transport.getConnectedUsername());
	assertEquals("password", sender.transport.getConnectedPassword());
	assertTrue(sender.transport.isCloseCalled());
	assertEquals(1, sender.transport.getSentMessages().size());
	assertEquals(message.getMimeMessage(), sender.transport.getSentMessage(0));
}
 
Example #9
Source File: TaskExecutionItem.java    From unitime with Apache License 2.0 5 votes vote down vote up
protected void onFinished() {
	org.hibernate.Session hibSession = TaskExecutionDAO.getInstance().createNewSession();
	Transaction tx = hibSession.beginTransaction();
	try {
		TaskExecution execution = TaskExecutionDAO.getInstance().get(getTaskExecutionId(), hibSession);
		if (execution != null) {
			execution.setFinishedDate(new Date());
			execution.setExecutionStatus(hasError() ? ExecutionStatus.FAILED.ordinal() : ExecutionStatus.FINISHED.ordinal());
			execution.setStatusMessageCheckLength(status());
			execution.setLogFile(createGson().toJson(getLog()));
			if (output() != null && output().exists()) {
				execution.setOutputName(getOutputName());
				execution.setOutputContentType(FileTypeMap.getDefaultFileTypeMap().getContentType(output()));
				FileInputStream is = new FileInputStream(output());
				try {
					execution.setOutputFile(IOUtils.toByteArray(is));
				} finally {
					is.close();
				}
			}
			hibSession.saveOrUpdate(execution);
		}
		hibSession.flush();
		tx.commit();
	} catch (Exception e) {
		tx.rollback();
	} finally {
		hibSession.close();
	}
}
 
Example #10
Source File: BinaryResourceDownloadMeta.java    From eplmp with Eclipse Public License 1.0 5 votes vote down vote up
private static void initFileTypeMap() {
    fileTypeMap = new MimetypesFileTypeMap();

    // Additional MIME types
    fileTypeMap.addMimeTypes("application/atom+xml atom");
    fileTypeMap.addMimeTypes("application/msword doc dot");
    fileTypeMap.addMimeTypes("application/mspowerpoint ppt pot");
    fileTypeMap.addMimeTypes("application/msexcel xls");
    fileTypeMap.addMimeTypes("application/pdf pdf");
    fileTypeMap.addMimeTypes("application/rdf+xml rdf rss");
    fileTypeMap.addMimeTypes("application/x-vnd.openxmlformat docx docm dotx dotm");
    fileTypeMap.addMimeTypes("application/x-vnd.openxmlformat xlsx xlsm");
    fileTypeMap.addMimeTypes("application/x-vnd.openxmlformat pptx pptm potx");
    fileTypeMap.addMimeTypes("application/x-javascript js");
    fileTypeMap.addMimeTypes("application/x-rar-compressed rar");
    fileTypeMap.addMimeTypes("application/x-textedit bat cmd");
    fileTypeMap.addMimeTypes("application/zip zip");
    fileTypeMap.addMimeTypes("audio/mpeg mp3");
    fileTypeMap.addMimeTypes("image/bmp bmp");
    fileTypeMap.addMimeTypes("image/gif gif");
    fileTypeMap.addMimeTypes("image/jpeg jpg jpeg jpe");
    fileTypeMap.addMimeTypes("image/png png");
    fileTypeMap.addMimeTypes("text/css css");
    fileTypeMap.addMimeTypes("text/csv csv");
    fileTypeMap.addMimeTypes("text/html htm html");
    fileTypeMap.addMimeTypes("text/xml xml");
    fileTypeMap.addMimeTypes("video/quicktime qt mov moov");
    fileTypeMap.addMimeTypes("video/mpeg mpeg mpg mpe mpv vbs mpegv");
    fileTypeMap.addMimeTypes("video/msvideo avi");
    fileTypeMap.addMimeTypes("video/mp4 mp4");
    fileTypeMap.addMimeTypes("video/ogg ogg");

    FileTypeMap.setDefaultFileTypeMap(fileTypeMap);
}
 
Example #11
Source File: MockServletContextTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Introduced to dispel claims in a thread on Stack Overflow:
 * <a href="http://stackoverflow.com/questions/22986109/testing-spring-managed-servlet">Testing Spring managed servlet</a>
 */
@Test
public void getMimeTypeWithCustomConfiguredType() {
	FileTypeMap defaultFileTypeMap = FileTypeMap.getDefaultFileTypeMap();
	assertThat(defaultFileTypeMap, instanceOf(MimetypesFileTypeMap.class));
	MimetypesFileTypeMap mimetypesFileTypeMap = (MimetypesFileTypeMap) defaultFileTypeMap;
	mimetypesFileTypeMap.addMimeTypes("text/enigma    enigma");
	assertEquals("text/enigma", sc.getMimeType("filename.enigma"));
}
 
Example #12
Source File: ConfigurableMimeFileTypeMap.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Return the delegate FileTypeMap, compiled from the mappings in the mapping file
 * and the entries in the {@code mappings} property.
 * @see #setMappingLocation
 * @see #setMappings
 * @see #createFileTypeMap
 */
protected final FileTypeMap getFileTypeMap() {
	if (this.fileTypeMap == null) {
		try {
			this.fileTypeMap = createFileTypeMap(this.mappingLocation, this.mappings);
		}
		catch (IOException ex) {
			throw new IllegalStateException(
					"Could not load specified MIME type mapping file: " + this.mappingLocation, ex);
		}
	}
	return this.fileTypeMap;
}
 
Example #13
Source File: ConfigurableMimeFileTypeMap.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the delegate FileTypeMap, compiled from the mappings in the mapping file
 * and the entries in the {@code mappings} property.
 * @see #setMappingLocation
 * @see #setMappings
 * @see #createFileTypeMap
 */
protected final FileTypeMap getFileTypeMap() {
	if (this.fileTypeMap == null) {
		try {
			this.fileTypeMap = createFileTypeMap(this.mappingLocation, this.mappings);
		}
		catch (IOException ex) {
			throw new IllegalStateException(
					"Could not load specified MIME type mapping file: " + this.mappingLocation, ex);
		}
	}
	return this.fileTypeMap;
}
 
Example #14
Source File: SmartMimeMessage.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Create a new SmartMimeMessage.
 * @param session the JavaMail Session to create the message for
 * @param defaultEncoding the default encoding, or {@code null} if none
 * @param defaultFileTypeMap the default FileTypeMap, or {@code null} if none
 */
public SmartMimeMessage(
		Session session, @Nullable String defaultEncoding, @Nullable FileTypeMap defaultFileTypeMap) {

	super(session);
	this.defaultEncoding = defaultEncoding;
	this.defaultFileTypeMap = defaultFileTypeMap;
}
 
Example #15
Source File: ByteArrayDataSource.java    From unitime with Apache License 2.0 5 votes vote down vote up
public ByteArrayDataSource(File file) throws FileNotFoundException, IOException {
	iName = file.getName();
	iContentType = FileTypeMap.getDefaultFileTypeMap().getContentType(file);
	FileInputStream is = new FileInputStream(file);
	try {
		iData = IOUtils.toByteArray(is);
	} finally {
		is.close();
	}
}
 
Example #16
Source File: cfMAIL.java    From openbd-core with GNU General Public License v3.0 5 votes vote down vote up
private void addAttachments( Enumeration<fileAttachment> _attach, Multipart _parent, boolean _isInline ) throws MessagingException{
	while ( _attach.hasMoreElements() ){
		fileAttachment nextFile = _attach.nextElement();
		FileDataSource fds 			= new FileDataSource( nextFile.getFilepath() );
		String mimeType = nextFile.getMimetype();
		if (mimeType == null){
			// if mime type not supplied then auto detect
			mimeType = FileTypeMap.getDefaultFileTypeMap().getContentType(nextFile.getFilepath());
     }else{
			// since mime type is not null then it the mime type has been set manually therefore
			// we need to ensure that any call to the underlying FileDataSource.getFileTypeMap()
			// returns a FileTypeMap that will map to this type
			fds.setFileTypeMap(new CustomFileTypeMap(mimeType));
		}
		
		String filename = cleanName(fds.getName());
		try {
			// encode the filename to ensure that it contains US-ASCII characters only
			filename = MimeUtility.encodeText( filename, "utf-8", "b" );
		} catch (UnsupportedEncodingException e5) {
			// shouldn't occur
		}
	  MimeBodyPart mimeAttach	= new MimeBodyPart();
	  mimeAttach.setDataHandler( new DataHandler(fds) );
		mimeAttach.setFileName( filename );

		ContentType ct = new ContentType(mimeType);
		ct.setParameter("name", filename );
		
		mimeAttach.setHeader("Content-Type", ct.toString() );

		if ( _isInline ){
       mimeAttach.setDisposition( "inline" );
       mimeAttach.addHeader( "Content-id", "<" + nextFile.getContentid() + ">" );
		}
     
		_parent.addBodyPart(mimeAttach);
	}
}
 
Example #17
Source File: ConfigurableMimeFileTypeMap.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Return the delegate FileTypeMap, compiled from the mappings in the mapping file
 * and the entries in the {@code mappings} property.
 * @see #setMappingLocation
 * @see #setMappings
 * @see #createFileTypeMap
 */
protected final FileTypeMap getFileTypeMap() {
	if (this.fileTypeMap == null) {
		try {
			this.fileTypeMap = createFileTypeMap(this.mappingLocation, this.mappings);
		}
		catch (IOException ex) {
			throw new IllegalStateException(
					"Could not load specified MIME type mapping file: " + this.mappingLocation, ex);
		}
	}
	return this.fileTypeMap;
}
 
Example #18
Source File: SimpleEmailServiceJavaMailSenderTest.java    From spring-cloud-aws with Apache License 2.0 5 votes vote down vote up
@Test
void createMimeMessage_withCustomFileTypeMap_fileTypeMapIsAvailableInMailSender() {
	// Arrange
	SimpleEmailServiceJavaMailSender mailSender = new SimpleEmailServiceJavaMailSender(
			null);
	mailSender.setDefaultFileTypeMap(FileTypeMap.getDefaultFileTypeMap());

	// Act
	MimeMessage mimeMessage = mailSender.createMimeMessage();
	MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage);

	// Assert
	assertThat(mimeMessageHelper.getFileTypeMap()).as("ISO-8859-1").isNotNull();
}
 
Example #19
Source File: SmartMimeMessage.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Create a new SmartMimeMessage.
 * @param session the JavaMail Session to create the message for
 * @param defaultEncoding the default encoding, or {@code null} if none
 * @param defaultFileTypeMap the default FileTypeMap, or {@code null} if none
 */
public SmartMimeMessage(
		Session session, @Nullable String defaultEncoding, @Nullable FileTypeMap defaultFileTypeMap) {

	super(session);
	this.defaultEncoding = defaultEncoding;
	this.defaultFileTypeMap = defaultFileTypeMap;
}
 
Example #20
Source File: FileBasedCollection.java    From rome with Apache License 2.0 5 votes vote down vote up
private void updateMediaEntryAppLinks(final Entry entry, final String fileName, final boolean singleEntry) {

        // TODO: figure out why PNG is missing from Java MIME types
        final FileTypeMap map = FileTypeMap.getDefaultFileTypeMap();
        if (map instanceof MimetypesFileTypeMap) {
            try {
                ((MimetypesFileTypeMap) map).addMimeTypes("image/png png PNG");
            } catch (final Exception ignored) {
            }
        }
        entry.setId(getEntryMediaViewURI(fileName));
        entry.setTitle(fileName);
        entry.setUpdated(new Date());

        final List<Link> otherlinks = new ArrayList<Link>();
        entry.setOtherLinks(otherlinks);

        final Link editlink = new Link();
        editlink.setRel("edit");
        editlink.setHref(getEntryEditURI(fileName, relativeURIs, singleEntry));
        otherlinks.add(editlink);

        final Link editMedialink = new Link();
        editMedialink.setRel("edit-media");
        editMedialink.setHref(getEntryMediaEditURI(fileName, relativeURIs, singleEntry));
        otherlinks.add(editMedialink);

        final Content content = entry.getContents().get(0);
        content.setSrc(getEntryMediaViewURI(fileName));
        final List<Content> contents = new ArrayList<Content>();
        contents.add(content);
        entry.setContents(contents);
    }
 
Example #21
Source File: ConfigurableMimeFileTypeMap.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Return the delegate FileTypeMap, compiled from the mappings in the mapping file
 * and the entries in the {@code mappings} property.
 * @see #setMappingLocation
 * @see #setMappings
 * @see #createFileTypeMap
 */
protected final FileTypeMap getFileTypeMap() {
	if (this.fileTypeMap == null) {
		try {
			this.fileTypeMap = createFileTypeMap(this.mappingLocation, this.mappings);
		}
		catch (IOException ex) {
			throw new IllegalStateException(
					"Could not load specified MIME type mapping file: " + this.mappingLocation, ex);
		}
	}
	return this.fileTypeMap;
}
 
Example #22
Source File: CamelFileDataSource.java    From camel-quarkus with Apache License 2.0 5 votes vote down vote up
@Override
public String getContentType() {
    if (typeMap == null) {
        return FileTypeMap.getDefaultFileTypeMap().getContentType(fileName);
    } else {
        return typeMap.getContentType(fileName);
    }
}
 
Example #23
Source File: DataSourceClassPathResolver.java    From commons-email with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public DataSource resolve(final String resourceLocation, final boolean isLenient) throws IOException
{
    DataSource result = null;

    try
    {
        if (!isCid(resourceLocation) && !isHttpUrl(resourceLocation))
        {
            final String mimeType = FileTypeMap.getDefaultFileTypeMap().getContentType(resourceLocation);
            final String resourceName = getResourceName(resourceLocation);
            final InputStream is = DataSourceClassPathResolver.class.getResourceAsStream(resourceName);

            if (is != null)
            {
                try
                {
                    final ByteArrayDataSource ds = new ByteArrayDataSource(is, mimeType);
                    // EMAIL-125: set the name of the DataSource to the normalized resource URL
                    // similar to other DataSource implementations, e.g. FileDataSource, URLDataSource
                    ds.setName(DataSourceClassPathResolver.class.getResource(resourceName).toString());
                    result = ds;
                }
                finally
                {
                    is.close();
                }
            }
            else
            {
                if (isLenient)
                {
                    return null;
                }
                throw new IOException("The following class path resource was not found : " + resourceLocation);
            }
        }


        return result;
    }
    catch (final IOException e)
    {
        if (isLenient)
        {
            return null;
        }
        throw e;
    }
}
 
Example #24
Source File: MockServletContext.java    From live-chat-engine with Apache License 2.0 4 votes vote down vote up
public static String getMimeType(String filePath) {
	return FileTypeMap.getDefaultFileTypeMap().getContentType(filePath);
}
 
Example #25
Source File: UnzipServlet.java    From packagedrone with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void init () throws ServletException
{
    super.init ();
    this.fileTypeMap = FileTypeMap.getDefaultFileTypeMap ();
}
 
Example #26
Source File: SmtpMailer.java    From alf.io with GNU General Public License v3.0 4 votes vote down vote up
CustomMimeMessage(Session session, String defaultEncoding, FileTypeMap defaultFileTypeMap) {
    super(session);
    this.defaultEncoding = defaultEncoding;
    this.defaultFileTypeMap = defaultFileTypeMap;
}
 
Example #27
Source File: MimeMessageHelper.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
/**
 * Return the {@code FileTypeMap} used by this MimeMessageHelper.
 */
public FileTypeMap getFileTypeMap() {
	return this.fileTypeMap;
}
 
Example #28
Source File: SmartMimeMessage.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
/**
 * Return the default FileTypeMap of this message, or {@code null} if none.
 */
public final FileTypeMap getDefaultFileTypeMap() {
	return this.defaultFileTypeMap;
}
 
Example #29
Source File: SmtpMailer.java    From alf.io with GNU General Public License v3.0 4 votes vote down vote up
public final FileTypeMap getDefaultFileTypeMap() {
    return this.defaultFileTypeMap;
}
 
Example #30
Source File: MockPortletContext.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
public static String getMimeType(String filePath) {
	return FileTypeMap.getDefaultFileTypeMap().getContentType(filePath);
}