public final class MediaType extends Object
This class is immutable. It overrides Object.equals(Object)
and Object.hashCode()
to allow comparing media types as described by RFC 2045, i.e. in a case insensitive way.
Modifier and Type | Field and Description |
---|---|
static MediaType |
APPLICATION_SOAP_XML
The media type for application/soap+xml.
|
static MediaType |
APPLICATION_XML
The media type for application/xml.
|
static MediaType |
APPLICATION_XOP_XML
The media type for application/xop+xml.
|
static MediaType |
MULTIPART_RELATED
The media type for multipart/related.
|
static MediaType |
TEXT_XML
The media type for text/xml.
|
Constructor and Description |
---|
MediaType(String type)
Constructor that parses a media type.
|
MediaType(String primaryType,
String subType)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getPrimaryType()
Get the primary type.
|
String |
getSubType()
Get the subtype.
|
int |
hashCode() |
String |
toString() |
public static final MediaType TEXT_XML
public static final MediaType APPLICATION_XML
public static final MediaType APPLICATION_SOAP_XML
public static final MediaType APPLICATION_XOP_XML
public static final MediaType MULTIPART_RELATED
public MediaType(String primaryType, String subType)
primaryType
- the primary typesubType
- the subtypepublic MediaType(String type) throws ParseException
type
- the media type to parseParseException
- if the value is invalid and could not be parsedCopyright © The Apache Software Foundation. All Rights Reserved.