Package org.basex.util.http
Class MediaType
java.lang.Object
org.basex.util.http.MediaType
- All Implemented Interfaces:
Comparable<MediaType>
Single Internet media type.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MediaTypeMedia type: wildcards.static final MediaTypeMedia type: application/html+xml.static final MediaTypeText/plain.static final MediaTypeMedia type: text/plain.static final MediaTypeMedia type: application/x-www-form-urlencoded.static final MediaTypeMedia type: application/xml.static final MediaTypeMedia type: application/xml-external-parsed-entity.static final MediaTypeMedia type: multipart/form-data.static final MediaTypeMedia type: text/comma-separated-values.static final MediaTypeMedia type: text/html.static final MediaTypeMedia type: text/plain.static final MediaTypeMedia type: text/xml.static final MediaTypeXML media type. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintstatic MediaTypeReturns the media type for the suffix of the specified file path.booleanChecks if the main and sub type of this and the specified type are equal.booleanisCSV()Checks if this is a CSV type.booleanisJSON()Checks if this is a JSON type.booleanChecks if this is a multipart type.booleanisText()Checks if this is a text type.booleanisXML()Checks if this is an XML type.booleanisXQuery()Checks if this is an XQuery type.main()Returns the main type.booleanChecks if the specified media type is contained in this media type.Returns the parameters.sub()Returns the sub type.toString()type()Returns the media type, composed from the main and sub type.
-
Field Details
-
ALL_ALL
Media type: wildcards. -
APPLICATION_X_WWW_FORM_URLENCODED
Media type: application/x-www-form-urlencoded. -
APPLICATION_HTML_XML
Media type: application/html+xml. -
APPLICATION_JSON
Text/plain. -
APPLICATION_OCTET_STREAM
Media type: text/plain. -
APPLICATION_XML
Media type: application/xml. -
APPLICATION_XML_EPE
Media type: application/xml-external-parsed-entity. -
MULTIPART_FORM_DATA
Media type: multipart/form-data. -
TEXT_CSV
Media type: text/comma-separated-values. -
TEXT_HTML
Media type: text/html. -
TEXT_PLAIN
Media type: text/plain. -
TEXT_XML
Media type: text/xml. -
TEXT_XML_EPE
XML media type.
-
-
Constructor Details
-
MediaType
Constructor.- Parameters:
string- media type string
-
-
Method Details
-
main
Returns the main type.- Returns:
- type
-
sub
Returns the sub type.- Returns:
- type
-
type
Returns the media type, composed from the main and sub type.- Returns:
- type without parameters
-
parameters
Returns the parameters.- Returns:
- parameters
-
isMultipart
public boolean isMultipart()Checks if this is a multipart type.- Returns:
- result of check
-
isText
public boolean isText()Checks if this is a text type.- Returns:
- result of check
-
isXQuery
public boolean isXQuery()Checks if this is an XQuery type.- Returns:
- result of check
-
isCSV
public boolean isCSV()Checks if this is a CSV type.- Returns:
- result of check
-
isXML
public boolean isXML()Checks if this is an XML type.- Returns:
- result of check
-
isJSON
public boolean isJSON()Checks if this is a JSON type.- Returns:
- result of check
-
matches
Checks if the specified media type is contained in this media type.- Parameters:
pattern- pattern- Returns:
- result of check
-
is
Checks if the main and sub type of this and the specified type are equal.- Parameters:
type- type- Returns:
- result of check
-
compareTo
- Specified by:
compareToin interfaceComparable<MediaType>
-
toString
-
get
Returns the media type for the suffix of the specified file path.application/octet-streamis returned if no type is found.- Parameters:
path- path to be checked- Returns:
- media type
-