Interface DocumentType


  • public interface DocumentType
    Holds the information describing the type of the document.

    The type of the document such as HTML, PDF, XML etc. This does not include the charset.

    • Field Detail

      • MIME_HTML_TEXT

        static final DocumentType MIME_HTML_TEXT
        Simple html MIME type which should be used when a filter converts a document to html.
      • MIME_APPLICATION_JSON_TEXT

        static final DocumentType MIME_APPLICATION_JSON_TEXT
        Simple json MIME type which should be used when a filter converts a document to json.
      • APPLICATION_JSON_TEXT

        @Deprecated
        static final DocumentType APPLICATION_JSON_TEXT
        Deprecated.
        Simple json MIME type which should be used when a filter converts a document to json.
      • MIME_XML_TEXT

        static final DocumentType MIME_XML_TEXT
        Simple xml MIME type which should be used when a filter converts a document to xml.
      • MIME_CSV_TEXT

        static final DocumentType MIME_CSV_TEXT
        Standard CSV MIME type which should be used when a filter converts a documen to CSV
      • MIME_XHTML_TEXT

        static final DocumentType MIME_XHTML_TEXT
        Simple xhtml MIME type which should be used when a filter converts a document to xhtml.
      • MIME_UNKNOWN

        static final DocumentType MIME_UNKNOWN
        A mime type that is unknown. Filters may be written to detect this and replace the mime type with something better.
      • MIME_TEXT_PLAIN

        static final DocumentType MIME_TEXT_PLAIN
        A document type for plain text documents.
    • Method Detail

      • isHTML

        boolean isHTML()
        Returns:
        true if the document type is considered to be HTML, includes xhtml, otherwise false.
      • isXML

        boolean isXML()
        Returns:
        true if the document type is considered to be XML, includes xhtml, otherwise false.
      • isJSON

        boolean isJSON()
        Returns:
        true if the document type is considered to be JSON, otherwise false.
      • asContentType

        java.lang.String asContentType()
        Gets the document type as a Content-Type header value.
        Returns:
        the document type as a HTTP compatible Content-Type.
      • fromContentType

        static DocumentType fromContentType​(java.lang.String contentType)
        Creates a DocumentType from HTTP header Content-Type.
        Parameters:
        contentType - the HTTP content type which will be used to create DocumentType from.
        Returns:
        a DocumentType constructed from the given contentType.