- Application octet stream java
- Field Summary
- Constructor Summary
- Method Summary
- Methods inherited from class java.lang.Object
- Field Detail
- ALL
- ALL_VALUE
- APPLICATION_ATOM_XML
- APPLICATION_ATOM_XML_VALUE
- APPLICATION_RSS_XML
- APPLICATION_RSS_XML_VALUE
- APPLICATION_FORM_URLENCODED
- APPLICATION_FORM_URLENCODED_VALUE
- APPLICATION_JSON
- APPLICATION_JSON_VALUE
- APPLICATION_OCTET_STREAM
- APPLICATION_OCTET_STREAM_VALUE
- APPLICATION_XHTML_XML
- APPLICATION_XHTML_XML_VALUE
- APPLICATION_XML
- APPLICATION_XML_VALUE
- APPLICATION_WILDCARD_XML
- APPLICATION_WILDCARD_XML_VALUE
- IMAGE_GIF
- IMAGE_GIF_VALUE
- IMAGE_JPEG
- IMAGE_JPEG_VALUE
- IMAGE_PNG
- IMAGE_PNG_VALUE
- MULTIPART_FORM_DATA
- MULTIPART_FORM_DATA_VALUE
- TEXT_HTML
- TEXT_HTML_VALUE
- TEXT_PLAIN
- TEXT_PLAIN_VALUE
- TEXT_XML
- TEXT_XML_VALUE
- SPECIFICITY_COMPARATOR
- QUALITY_VALUE_COMPARATOR
- Constructor Detail
- MediaType
- MediaType
- MediaType
- MediaType
- MediaType
- MediaType
- Method Detail
- getType
- isWildcardType
- getSubtype
- isWildcardSubtype
- isConcrete
- getCharSet
- getQualityValue
- getParameter
- getParameters
- includes
- isCompatibleWith
- copyQualityValue
- removeQualityValue
- compareTo
- equals
- hashCode
- toString
- valueOf
- parseMediaType
- parseMediaTypes
- toString
- sortBySpecificity
- sortByQualityValue
- sortBySpecificityAndQuality
- Application octet stream java
- Methods inherited from class java.lang.Object
- Field Detail
- CHARSET_PARAMETER
- MEDIA_TYPE_WILDCARD
- WILDCARD
- WILDCARD_TYPE
- APPLICATION_XML
- APPLICATION_XML_TYPE
- APPLICATION_ATOM_XML
- APPLICATION_ATOM_XML_TYPE
- APPLICATION_XHTML_XML
- APPLICATION_XHTML_XML_TYPE
- APPLICATION_SVG_XML
- APPLICATION_SVG_XML_TYPE
- APPLICATION_JSON
- APPLICATION_JSON_TYPE
- APPLICATION_FORM_URLENCODED
- APPLICATION_FORM_URLENCODED_TYPE
- MULTIPART_FORM_DATA
- MULTIPART_FORM_DATA_TYPE
- APPLICATION_OCTET_STREAM
- APPLICATION_OCTET_STREAM_TYPE
- TEXT_PLAIN
- TEXT_PLAIN_TYPE
- TEXT_XML
- TEXT_XML_TYPE
- TEXT_HTML
- TEXT_HTML_TYPE
- Constructor Detail
- MediaType
- MediaType
- MediaType
- MediaType
- Method Detail
- valueOf
- getType
- isWildcardType
- getSubtype
- isWildcardSubtype
- getParameters
- withCharset
- isCompatible
- equals
- hashCode
- toString
Application octet stream java
Represents an Internet Media Type, as defined in the HTTP specification. Consists of a type and a subtype. Also has functionality to parse media types from a string using parseMediaType(String) , or multiple comma-separated media types using parseMediaTypes(String) .
Field Summary
Constructor Summary
Copy-constructor that copies the type and subtype of the given MediaType , and allows for different parameter.
Method Summary
Indicates whether the subtype is the wildcard character * or the wildcard character followed by a sufiix (e.g.
Sorts the given list of MediaType objects by specificity as the primary criteria and quality value the secondary.
Parse the given String value into a MediaType object, with this method name following the ‘valueOf’ naming convention (as supported by ConversionService .
Methods inherited from class java.lang.Object
Field Detail
ALL
ALL_VALUE
public static final java.lang.String ALL_VALUE
APPLICATION_ATOM_XML
APPLICATION_ATOM_XML_VALUE
public static final java.lang.String APPLICATION_ATOM_XML_VALUE
APPLICATION_RSS_XML
APPLICATION_RSS_XML_VALUE
public static final java.lang.String APPLICATION_RSS_XML_VALUE
APPLICATION_FORM_URLENCODED
public static final MediaType APPLICATION_FORM_URLENCODED
APPLICATION_FORM_URLENCODED_VALUE
public static final java.lang.String APPLICATION_FORM_URLENCODED_VALUE
APPLICATION_JSON
APPLICATION_JSON_VALUE
public static final java.lang.String APPLICATION_JSON_VALUE
APPLICATION_OCTET_STREAM
APPLICATION_OCTET_STREAM_VALUE
public static final java.lang.String APPLICATION_OCTET_STREAM_VALUE
APPLICATION_XHTML_XML
APPLICATION_XHTML_XML_VALUE
public static final java.lang.String APPLICATION_XHTML_XML_VALUE
APPLICATION_XML
APPLICATION_XML_VALUE
public static final java.lang.String APPLICATION_XML_VALUE
APPLICATION_WILDCARD_XML
APPLICATION_WILDCARD_XML_VALUE
public static final java.lang.String APPLICATION_WILDCARD_XML_VALUE
IMAGE_GIF
IMAGE_GIF_VALUE
public static final java.lang.String IMAGE_GIF_VALUE
IMAGE_JPEG
IMAGE_JPEG_VALUE
public static final java.lang.String IMAGE_JPEG_VALUE
IMAGE_PNG
IMAGE_PNG_VALUE
public static final java.lang.String IMAGE_PNG_VALUE
MULTIPART_FORM_DATA
MULTIPART_FORM_DATA_VALUE
public static final java.lang.String MULTIPART_FORM_DATA_VALUE
TEXT_HTML
TEXT_HTML_VALUE
public static final java.lang.String TEXT_HTML_VALUE
TEXT_PLAIN
TEXT_PLAIN_VALUE
public static final java.lang.String TEXT_PLAIN_VALUE
TEXT_XML
TEXT_XML_VALUE
public static final java.lang.String TEXT_XML_VALUE
SPECIFICITY_COMPARATOR
QUALITY_VALUE_COMPARATOR
Constructor Detail
MediaType
public MediaType(java.lang.String type)
MediaType
public MediaType(java.lang.String type, java.lang.String subtype)
MediaType
public MediaType(java.lang.String type, java.lang.String subtype, java.nio.charset.Charset charset)
MediaType
public MediaType(java.lang.String type, java.lang.String subtype, double qualityValue)
MediaType
public MediaType(MediaType other, java.util.Map parameters)
Copy-constructor that copies the type and subtype of the given MediaType , and allows for different parameter.
MediaType
public MediaType(java.lang.String type, java.lang.String subtype, java.util.Map parameters)
Method Detail
getType
public java.lang.String getType()
isWildcardType
public boolean isWildcardType()
getSubtype
public java.lang.String getSubtype()
isWildcardSubtype
public boolean isWildcardSubtype()
Indicates whether the subtype is the wildcard character * or the wildcard character followed by a sufiix (e.g. *+xml ), or not.
isConcrete
public boolean isConcrete()
Indicates whether this media type is concrete, i.e. whether neither the type or subtype is a wildcard character * .
getCharSet
public java.nio.charset.Charset getCharSet()
getQualityValue
public double getQualityValue()
getParameter
public java.lang.String getParameter(java.lang.String name)
getParameters
public java.util.Map getParameters()
includes
Indicate whether this MediaType includes the given media type. For instance, text/* includes text/plain and text/html , and application/*+xml includes application/soap+xml , etc. This method is not symmetric.
isCompatibleWith
Indicate whether this MediaType is compatible with the given media type. For instance, text/* is compatible with text/plain , text/html , and vice versa. In effect, this method is similar to includes(MediaType) , except that it is symmetric.
copyQualityValue
public MediaType copyQualityValue(MediaType mediaType)
removeQualityValue
compareTo
equals
public boolean equals(java.lang.Object other)
hashCode
toString
public java.lang.String toString()
valueOf
public static MediaType valueOf(java.lang.String value)
Parse the given String value into a MediaType object, with this method name following the ‘valueOf’ naming convention (as supported by ConversionService .
parseMediaType
public static MediaType parseMediaType(java.lang.String mediaType)
parseMediaTypes
public static java.util.ListMediaType> parseMediaTypes(java.lang.String mediaTypes)
Parse the given, comma-separated string into a list of MediaType objects. This method can be used to parse an Accept or Content-Type header.
toString
Return a string representation of the given list of MediaType objects. This method can be used to for an Accept or Content-Type header.
sortBySpecificity
- if either media type has a wildcard type, then the media type without the wildcard is ordered before the other.
- if the two media types have different types, then they are considered equal and remain their current order.
- if either media type has a wildcard subtype, then the media type without the wildcard is sorted before the other.
- if the two media types have different subtypes, then they are considered equal and remain their current order.
- if the two media types have different quality value, then the media type with the highest quality value is ordered before the other.
- if the two media types have a different amount of parameters, then the media type with the most parameters is ordered before the other.
sortByQualityValue
- if the two media types have different quality value, then the media type with the highest quality value is ordered before the other.
- if either media type has a wildcard type, then the media type without the wildcard is ordered before the other.
- if the two media types have different types, then they are considered equal and remain their current order.
- if either media type has a wildcard subtype, then the media type without the wildcard is sorted before the other.
- if the two media types have different subtypes, then they are considered equal and remain their current order.
- if the two media types have a different amount of parameters, then the media type with the most parameters is ordered before the other.
sortBySpecificityAndQuality
Sorts the given list of MediaType objects by specificity as the primary criteria and quality value the secondary.
Application octet stream java
Compares obj to this media type to see if they are the same by comparing type, subtype and parameters.
Create a new MediaType instance with the same type, subtype and parameters copied from the original instance and the supplied «»charset»» parameter.
Methods inherited from class java.lang.Object
Field Detail
CHARSET_PARAMETER
MEDIA_TYPE_WILDCARD
WILDCARD
WILDCARD_TYPE
APPLICATION_XML
APPLICATION_XML_TYPE
APPLICATION_ATOM_XML
APPLICATION_ATOM_XML_TYPE
public static final MediaType APPLICATION_ATOM_XML_TYPE
APPLICATION_XHTML_XML
APPLICATION_XHTML_XML_TYPE
public static final MediaType APPLICATION_XHTML_XML_TYPE
APPLICATION_SVG_XML
APPLICATION_SVG_XML_TYPE
APPLICATION_JSON
APPLICATION_JSON_TYPE
APPLICATION_FORM_URLENCODED
public static final String APPLICATION_FORM_URLENCODED
APPLICATION_FORM_URLENCODED_TYPE
public static final MediaType APPLICATION_FORM_URLENCODED_TYPE
MULTIPART_FORM_DATA
MULTIPART_FORM_DATA_TYPE
APPLICATION_OCTET_STREAM
APPLICATION_OCTET_STREAM_TYPE
public static final MediaType APPLICATION_OCTET_STREAM_TYPE
TEXT_PLAIN
TEXT_PLAIN_TYPE
TEXT_XML
TEXT_XML_TYPE
TEXT_HTML
TEXT_HTML_TYPE
Constructor Detail
MediaType
public MediaType(String type, String subtype, Mapparameters)
MediaType
MediaType
public MediaType(String type, String subtype, String charset)
MediaType
Creates a new instance of MediaType , both type and subtype are wildcards. Consider using the constant WILDCARD_TYPE instead.
Method Detail
valueOf
getType
isWildcardType
public boolean isWildcardType()
getSubtype
isWildcardSubtype
public boolean isWildcardSubtype()
getParameters
public MapString,String> getParameters()
withCharset
public MediaType withCharset(String charset)
Create a new MediaType instance with the same type, subtype and parameters copied from the original instance and the supplied «»charset»» parameter.
isCompatible
Check if this media type is compatible with another media type. E.g. image/* is compatible with image/jpeg, image/png, etc. Media type parameters are ignored. The function is commutative.
equals
Compares obj to this media type to see if they are the same by comparing type, subtype and parameters. Note that the case-sensitivity of parameter values is dependent on the semantics of the parameter name, see HTTP/1.1. This method assumes that values are case-sensitive. Note that the equals(. ) implementation does not perform a class equality check ( this.getClass() == obj.getClass() ). Therefore any class that extends from MediaType class and needs to override one of the equals(. ) and hashCode() methods must always override both methods to ensure the contract between Object.equals(java.lang.Object) and Object.hashCode() does not break.
hashCode
Generate a hash code from the type, subtype and parameters. Note that the equals(java.lang.Object) implementation does not perform a class equality check ( this.getClass() == obj.getClass() ). Therefore any class that extends from MediaType class and needs to override one of the equals(Object) and hashCode() methods must always override both methods to ensure the contract between Object.equals(java.lang.Object) and Object.hashCode() does not break.