Class DefaultMimetypesExtensionTranslationMapFactory

  • All Implemented Interfaces:
    MimetypesExtensionTranslationMapFactory

    public class DefaultMimetypesExtensionTranslationMapFactory
    extends Object
    implements MimetypesExtensionTranslationMapFactory
    As MimeTypesFileTypeMap only allows one way conversion (from file to mime type) this class manually parses the file and can be used for reverse mapping.

    NOTE: The current email infrastructure relies on a DataSource to represent an email attachment. Because of this, DataSource.name is used for both the ContentId and Filename. Some email services like Amazon SES require a valid filename (including extension), this class is used to determine a reasonable extension for a DataSources mime type and append it to the end of a file name. Ideally, we'd use another object to represent an attachment, and preserve the content-id, intended file name (w/ attachment) there.