| java.lang.Object | |
| ↳ | com.google.gdata.util.ContentType |
Simple class for parsing and generating Content-Type header values, per RFC 2045 (MIME) and 2616 (HTTP 1.1).
| Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| String | ATTR_CHARSET | Name of the attribute that contains the encoding character set for the content type. | |||||||||
| String | DEFAULT_CHARSET | The UTF-8 charset encoding is used by default for all text and xml based MIME types. | |||||||||
| String | STAR | Special "*" character to match any type or subtype. | |||||||||
| Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| ANY | Wildcard content type that will match any MIME type | ||||||||||
| APPLICATION_XML | A ContentType constant that describes the application/xml content type. | ||||||||||
| ATOM | A ContentType constant that describes the base unqualified Atom content type. | ||||||||||
| ATOM_ENTRY | A ContentType constant that describes the qualified Atom entry content type. | ||||||||||
| ATOM_FEED | A ContentType constant that describes the qualified Atom feed content type. | ||||||||||
| ATOM_SERVICE | A ContentType constant that describes the Atom Service content type. | ||||||||||
| ATTR_PATTERN | |||||||||||
| GDATA_ERROR | A ContentType constant that describes the GData error content type. | ||||||||||
| JAVASCRIPT | A ContentType constant that describes the Javascript content type. | ||||||||||
| JSON | A ContentType constant that describes the JSON content type. | ||||||||||
| MESSAGE_RFC822 | A ContentType constant that indicates that the body contains an encapsulated message, with the syntax of an RFC 822 email message. | ||||||||||
| MULTIPART_RELATED | A ContentType constant that describes the MIME multipart/related content type. | ||||||||||
| OPENSEARCH | A ContentType constant that describes the OpenSearch description document | ||||||||||
| RSS | A ContentType constant that describes the RSS channel/item content type. | ||||||||||
| TEXT_HTML | A ContentType constant that describes the generic text/html content type. | ||||||||||
| TEXT_PLAIN | A ContentType constant that describes the generic text/plain content type. | ||||||||||
| TEXT_XML | A ContentType constant that describes the generic text/xml content type. | ||||||||||
| TOKEN | |||||||||||
| TOKEN_PATTERN | |||||||||||
| TYPE_PATTERN | |||||||||||
| attributes | |||||||||||
| inferredCharset | true if parsed input didn't contain charset encoding info |
||||||||||
| locked | If set to true, the object is immutable. |
||||||||||
| subType | |||||||||||
| type | |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new instance with default media type
| |||||||||||
Constructs a new instance from a content-type header value
parsing the MIME content type (RFC2045) format.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Returns the ContentType that should be used in contexts that expect
an Atom entry.
| |||||||||||
Returns the ContentType that should be used in contexts that expect
an Atom feed.
| |||||||||||
Returns the additional attribute by name of the content type.
| |||||||||||
Returns the additional attributes of the content type.
| |||||||||||
Determines the best "Content-Type" header to use in a servlet response
based on the "Accept" header from a servlet request.
| |||||||||||
Returns the full media type
| |||||||||||
Makes the object immutable and returns it.
| |||||||||||
Returns whether this content type is match by the content type found in the
"Accept" header field of an HTTP request.
| |||||||||||
Generates the Content-Type value
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
Name of the attribute that contains the encoding character set for the content type.
The UTF-8 charset encoding is used by default for all text and xml based MIME types.
Special "*" character to match any type or subtype.
A ContentType constant that describes the application/xml content type.
A ContentType constant that describes the base unqualified Atom content type.
A ContentType constant that describes the qualified Atom entry content type.
A ContentType constant that describes the qualified Atom feed content type.
A ContentType constant that describes the Atom Service content type.
A ContentType constant that describes the GData error content type.
A ContentType constant that describes the Javascript content type.
A ContentType constant that indicates that the body contains an encapsulated message, with the syntax of an RFC 822 email message.
A ContentType constant that describes the MIME multipart/related content type.
A ContentType constant that describes the OpenSearch description document
A ContentType constant that describes the RSS channel/item content type.
A ContentType constant that describes the generic text/html content type.
A ContentType constant that describes the generic text/plain content type.
A ContentType constant that describes the generic text/xml content type.
true if parsed input didn't contain charset encoding info
If set to true, the object is immutable.
Constructs a new instance with default media type
Constructs a new instance from a content-type header value
parsing the MIME content type (RFC2045) format. If the type
is null, then media type and charset will be
initialized to default values.
| typeHeader | Content type value in RFC2045 header format. |
|---|
| o |
|---|
Returns the ContentType that should be used in contexts that expect an Atom entry.
Returns the ContentType that should be used in contexts that expect an Atom feed.
Returns the additional attribute by name of the content type.
| name | Attribute name |
|---|
Returns the additional attributes of the content type.
Determines the best "Content-Type" header to use in a servlet response based on the "Accept" header from a servlet request.
| acceptHeader | "Accept" header value from a servlet request (not
null) |
|---|---|
| actualContentTypes | Actual content types in descending order of
preference (non-empty, and each entry is of the
form "type/subtype" without the wildcard char
'*') or null if no "Accept" header
was specified |
null on no match).
Returns the full media type
Makes the object immutable and returns it.
This should at least be used when keeping a ContentType instance as
a static.
Returns whether this content type is match by the content type found in the "Accept" header field of an HTTP request.
For atom content type, this method will check the optional attribute
'type'. If the type attribute is set in both this and acceptedContentType, then they must be the same. That is, application/atom+xml will match both application/atom+xml;type=feed and application/atom+xml;type=entry, but application/atom+xml;type=entry will not match application/atom+xml;type=feed.a
| acceptedContentType | Content type found in the "Accept" header field of an HTTP request |
|---|
| subType |
|---|
| type |
|---|
Generates the Content-Type value