Package org.mockserver.model
Class MediaType
- java.lang.Object
-
- org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString
-
- org.mockserver.model.ObjectWithJsonToString
-
- org.mockserver.model.MediaType
-
public class MediaType extends ObjectWithJsonToString
-
-
Field Summary
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MediaType
create(String type, String subType)
Charset
getCharset()
Charset
getCharsetOrDefault()
Map<String,String>
getParameters()
String
getSubtype()
String
getType()
boolean
isCompatible(MediaType other)
boolean
isJson()
boolean
isString()
boolean
isXml()
static MediaType
parse(String mediaTypeHeader)
String
toString()
MediaType
withCharset(String charset)
MediaType
withCharset(Charset charset)
-
Methods inherited from class org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString
equals, fieldsExcludedFromEqualsAndHashCode, hashCode, key
-
-
-
-
Field Detail
-
DEFAULT_HTTP_CHARACTER_SET
public static final Charset DEFAULT_HTTP_CHARACTER_SET
The default character set for an HTTP message, if none is specified in the Content-Type header. From the HTTP 1.1 specification section 3.7.1 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7.1):The "charset" parameter is used with some media types to define the character set (section 3.4) of the data. When no explicit charset parameter is provided by the sender, media subtypes of the "text" type are defined to have a default charset value of "ISO-8859-1" when received via HTTP. Data in character sets other than "ISO-8859-1" or its subsets MUST be labeled with an appropriate charset value.
-
WILDCARD
public static final MediaType WILDCARD
-
APPLICATION_ATOM_XML
public static final MediaType APPLICATION_ATOM_XML
-
APPLICATION_XHTML_XML
public static final MediaType APPLICATION_XHTML_XML
-
APPLICATION_SVG_XML
public static final MediaType APPLICATION_SVG_XML
-
APPLICATION_XML
public static final MediaType APPLICATION_XML
-
APPLICATION_XML_UTF_8
public static final MediaType APPLICATION_XML_UTF_8
-
APPLICATION_JSON
public static final MediaType APPLICATION_JSON
-
APPLICATION_JSON_UTF_8
public static final MediaType APPLICATION_JSON_UTF_8
-
JSON_UTF_8
public static final MediaType JSON_UTF_8
-
APPLICATION_FORM_URLENCODED
public static final MediaType APPLICATION_FORM_URLENCODED
-
FORM_DATA
public static final MediaType FORM_DATA
-
MULTIPART_FORM_DATA
public static final MediaType MULTIPART_FORM_DATA
-
APPLICATION_OCTET_STREAM
public static final MediaType APPLICATION_OCTET_STREAM
-
APPLICATION_BINARY
public static final MediaType APPLICATION_BINARY
-
PDF
public static final MediaType PDF
-
ATOM_UTF_8
public static final MediaType ATOM_UTF_8
-
TEXT_PLAIN
public static final MediaType TEXT_PLAIN
-
PLAIN_TEXT_UTF_8
public static final MediaType PLAIN_TEXT_UTF_8
-
TEXT_XML
public static final MediaType TEXT_XML
-
TEXT_XML_UTF_8
public static final MediaType TEXT_XML_UTF_8
-
XML_UTF_8
public static final MediaType XML_UTF_8
-
TEXT_HTML
public static final MediaType TEXT_HTML
-
TEXT_HTML_UTF_8
public static final MediaType TEXT_HTML_UTF_8
-
HTML_UTF_8
public static final MediaType HTML_UTF_8
-
SERVER_SENT_EVENTS
public static final MediaType SERVER_SENT_EVENTS
-
APPLICATION_JSON_PATCH_JSON
public static final MediaType APPLICATION_JSON_PATCH_JSON
-
ANY_VIDEO_TYPE
public static final MediaType ANY_VIDEO_TYPE
-
ANY_AUDIO_TYPE
public static final MediaType ANY_AUDIO_TYPE
-
ANY_IMAGE_TYPE
public static final MediaType ANY_IMAGE_TYPE
-
QUICKTIME
public static final MediaType QUICKTIME
-
JPEG
public static final MediaType JPEG
-
PNG
public static final MediaType PNG
-
-
Method Detail
-
getType
public String getType()
-
getSubtype
public String getSubtype()
-
getCharset
public Charset getCharset()
-
getCharsetOrDefault
public Charset getCharsetOrDefault()
-
isCompatible
public boolean isCompatible(MediaType other)
-
isJson
public boolean isJson()
-
isXml
public boolean isXml()
-
isString
public boolean isString()
-
toString
public String toString()
- Overrides:
toString
in classObjectWithJsonToString
-
-