org.restlet.engine.header
Class ContentType

java.lang.Object
  extended by org.restlet.engine.header.ContentType

public class ContentType
extends Object

Association of a media type, a character set and modifiers.

Author:
Jerome Louvel

Constructor Summary
ContentType(MediaType mediaType, CharacterSet characterSet)
          Constructor.
ContentType(Representation representation)
          Constructor.
ContentType(String headerValue)
          Constructor.
 
Method Summary
 CharacterSet getCharacterSet()
          Returns the character set.
 MediaType getMediaType()
          Returns the media type.
static CharacterSet readCharacterSet(String contentType)
          Parses the given content type header and returns the character set.
static MediaType readMediaType(String contentType)
          Parses the given content type header and returns the media type.
 String toString()
           
static String writeHeader(MediaType mediaType, CharacterSet characterSet)
          Writes the HTTP "Content-Type" header.
static String writeHeader(Representation representation)
          Writes the HTTP "Content-Type" header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContentType

public ContentType(MediaType mediaType,
                   CharacterSet characterSet)
Constructor.

Parameters:
mediaType - The media type.
characterSet - The character set.

ContentType

public ContentType(Representation representation)
Constructor.

Parameters:
representation - The representation.

ContentType

public ContentType(String headerValue)
Constructor.

Parameters:
headerValue - The "Content-type" header to parse.
Method Detail

readCharacterSet

public static CharacterSet readCharacterSet(String contentType)
Parses the given content type header and returns the character set.

Parameters:
contentType - The content type header to parse.
Returns:
The character set.

readMediaType

public static MediaType readMediaType(String contentType)
Parses the given content type header and returns the media type.

Parameters:
contentType - The content type header to parse.
Returns:
The media type.

writeHeader

public static String writeHeader(MediaType mediaType,
                                 CharacterSet characterSet)
Writes the HTTP "Content-Type" header.

Parameters:
mediaType - The representation media type.
characterSet - The representation character set.
Returns:
The HTTP "Content-Type" header.

writeHeader

public static String writeHeader(Representation representation)
Writes the HTTP "Content-Type" header.

Parameters:
representation - The related representation.
Returns:
The HTTP "Content-Type" header.

getCharacterSet

public CharacterSet getCharacterSet()
Returns the character set.

Returns:
The character set.

getMediaType

public MediaType getMediaType()
Returns the media type.

Returns:
The media type.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2005-2013 Restlet.