14.17 Content-Type The Content-Type entity-header field indicates the media type of the entity-body sent to the recipient or, in the case of the HEAD method, the media type that would have been sent had the request been a GET. Content-Type = "Content-Type" ":" media-type Media types are defined in section 3.7. An example of the field is Content-Type: text/html; charset=ISO-8859-4 Further discussion of methods for identifying the media type of an entity is provided in section 7.2.1. From HTTP RFC 2616@version 1.2 @author M. Ranganathan
The relevant productions from RFC 2045 and RFC 822 are:
content := "Content-Type" ":" type "/" subtype *(";" parameter) parameter := attribute "=" value attribute := token value := token / quoted-string token := 1*<any (US-ASCII) CHAR except SPACE, CTLs, or tspecials> tspecials := "(" / ")" / "<" / ">" / "@" / "," / ";" / ":" / "\" / <"> / "/" / "[" / "]" / "?" / "=" quoted-string := <"> *(qtext/quoted-pair) <"> qtext := <any CHAR excepting <">, "\" & CR, and including linear-white-space> quoted-pair := "\" CHAR
This class is similar to {@link MimeType} and JavaMail's ContentType
class, but thefollowing differences exist:
Another reason for the existence of this class is to avoid a dependency on JavaMail.
Note that this class doesn't override {@link Object#equals(Object)} because there is nomeaningful way to compare content types with parameters.
media-type = type "/" subtype *( ";" parameter ) type = token subtype = token
Especially for Accept
Header as defined in RFC 2616 chapter 14.1 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html)
: Accept = "Accept" ":" #( media-range [ accept-params ] ) media-range = ( "* /*" | ( type "/" "*" ) | ( type "/" subtype ) ) *( ";" parameter ) accept-params = ";" "q" "=" qvalue *( accept-extension ) accept-extension = ";" token [ "=" ( token | quoted-string ) ]
Especially for Content-Type
Header as defined in RFC 2616 chapter 14.7 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html)
: Content-Type = "Content-Type" ":" media-type
Once created a {@link ContentType} is IMMUTABLE.
This interface provides access to a content type and its supported portlet modes. A content type is defined as part of a portlet application in the portlet.xml. It is accessible via the ServletDefinition as it is bound to the application code.
This interface defines the model as known from the MVC pattern. Its purpose is to provide read access to the data stored in the model.
String[] onProvideCompletionsFromMyField(String input) { return . . .; }
charset
parameter is one of many parameters that can be associated with a MIME type. This however this exposes this parameter with a typed method. The getCharset
will return the character encoding the content type is encoded within. This allows the user of the content to decode it correctly. Other parameters can be acquired from this by simply providing the name of the parameter.
@author Niall Gallagher
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|