Class MimeTypeRecognizer


  • public class MimeTypeRecognizer
    extends Object
    Provides means to recognize mime-type information of the content (including mime-type itself and encoding)
    Version:
    $Id: MimeTypeRecognizer.java 23.08.2012 dkuleshov $
    Author:
    Dmitry Kuleshov
    • Constructor Detail

      • MimeTypeRecognizer

        public MimeTypeRecognizer​(String fileName,
                                  org.exoplatform.commons.utils.MimeTypeResolver mimeTypeResolver,
                                  javax.ws.rs.core.MediaType mediaType,
                                  boolean untrustedAgent)
        Constructor
        Parameters:
        fileName - - short name of the resource
        mimeTypeResolver - - provides means to resolve mime-type
        mediaType - - media type instance (stores mime-type and encoding)
        untrustedAgent - - shows if agent to provide resource and it's mime type is listed as trusted (no mime-type change is allowed for untrusted agents)
    • Method Detail

      • isMimeTypeRecognized

        public boolean isMimeTypeRecognized()
        Shows if mime-type is recognized by MimeTypeResolver.
      • isEncodingSet

        public boolean isEncodingSet()
        Shows if encoding is set via MediaType.
      • getMimeType

        public String getMimeType()
        Returns mime-type of a resource according to MediaType or MimeTypeResolver information.
      • getEncoding

        public String getEncoding()
        Returns encoding according to MediaType or null no encoding set or MediaType is no available.