Spring Framework
org.springframework.mail.javamail

Class ConfigurableMimeFileTypeMap

    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void afterPropertiesSet()
      Creates the final merged mapping set.
      protected javax.activation.FileTypeMap createFileTypeMap(Resource mappingLocation, java.lang.String[] mappings)
      Compile a FileTypeMap from the mappings in the given mapping file and the given mapping entries.
      java.lang.String getContentType(java.io.File file)
      Delegates to the underlying FileTypeMap.
      java.lang.String getContentType(java.lang.String fileName)
      Delegates to the underlying FileTypeMap.
      protected javax.activation.FileTypeMap getFileTypeMap()
      Return the delegate FileTypeMap, compiled from the mappings in the mapping file and the entries in the mappings property.
      void setMappingLocation(Resource mappingLocation)
      Specify the Resource from which mappings are loaded.
      void setMappings(java.lang.String[] mappings)
      Specify additional MIME type mappings as lines that follow the mime.types file format, as specified by the Java Activation Framework, for example:
      text/html html htm HTML HTM
      • Methods inherited from class javax.activation.FileTypeMap

        getDefaultFileTypeMap, setDefaultFileTypeMap
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConfigurableMimeFileTypeMap

        public ConfigurableMimeFileTypeMap()
    • Method Detail

      • setMappingLocation

        public void setMappingLocation(Resource mappingLocation)
        Specify the Resource from which mappings are loaded.

        Needs to follow the mime.types file format, as specified by the Java Activation Framework, containing lines such as:
        text/html html htm HTML HTM

      • setMappings

        public void setMappings(java.lang.String[] mappings)
        Specify additional MIME type mappings as lines that follow the mime.types file format, as specified by the Java Activation Framework, for example:
        text/html html htm HTML HTM
      • createFileTypeMap

        protected javax.activation.FileTypeMap createFileTypeMap(Resource mappingLocation,
                                                     java.lang.String[] mappings)
                                                          throws java.io.IOException
        Compile a FileTypeMap from the mappings in the given mapping file and the given mapping entries.

        The default implementation creates an Activation Framework MimetypesFileTypeMap, passing in an InputStream from the mapping resource (if any) and registering the mapping lines programmatically.

        Parameters:
        mappingLocation - a mime.types mapping resource (can be null)
        mappings - MIME type mapping lines (can be null)
        Returns:
        the compiled FileTypeMap
        Throws:
        java.io.IOException - if resource access failed
        See Also:
        MimetypesFileTypeMap.MimetypesFileTypeMap(java.io.InputStream), MimetypesFileTypeMap.addMimeTypes(String)
      • getContentType

        public java.lang.String getContentType(java.io.File file)
        Delegates to the underlying FileTypeMap.
        Specified by:
        getContentType in class javax.activation.FileTypeMap
        See Also:
        getFileTypeMap()
      • getContentType

        public java.lang.String getContentType(java.lang.String fileName)
        Delegates to the underlying FileTypeMap.
        Specified by:
        getContentType in class javax.activation.FileTypeMap
        See Also:
        getFileTypeMap()
Spring Framework