Class DefaultMimeRegistry

  • All Implemented Interfaces:
    Serializable, MimeRegistry

    public class DefaultMimeRegistry
    extends Object
    implements MimeRegistry, Serializable
    The default-mime registry contains a list of well-known file types and returns mime-information for them. This implementation recognizes a couple of image types and CSS, XML and HTML files. The content is recognized by its filename, not by its actual content.
    Author:
    Thomas Morgner
    See Also:
    Serialized Form
    • Constructor Detail

      • DefaultMimeRegistry

        public DefaultMimeRegistry()
        Default Constructor.
    • Method Detail

      • getMimeType

        public String getMimeType​(ContentItem item)
        Queries the mime-type for a given content-item. Some repositories store mime-type information along with the content data, while others might resort to heuristics based on the filename or actual data stored in the item.
        Specified by:
        getMimeType in interface MimeRegistry
        Parameters:
        item - the content item for which Mime-Data should be queried.
        Returns:
        the mime-type never null.
      • getMimeType

        public String getMimeType​(String filename)
        Queries the mime-type for a given filename. Some repositories store mime-type information along with the content data, while others might resort to heuristics based on the filename or actual data stored in the item.
        Parameters:
        filename - the content item for which Mime-Data should be queried.
        Returns:
        the mime-type never null.
      • getSuffix

        public String getSuffix​(String mimeType)
        Returns the default suffix for files with the given content type.
        Specified by:
        getSuffix in interface MimeRegistry
        Parameters:
        mimeType - the mime-type for which a suffix is queried.
        Returns:
        the suffix, never null.