Package org.restlet.engine.header
Class ContentType
- java.lang.Object
-
- org.restlet.engine.header.ContentType
-
public class ContentType extends java.lang.Object
Association of a media type, a character set and modifiers.- Author:
- Jerome Louvel
-
-
Constructor Summary
Constructors Constructor Description ContentType(java.lang.String headerValue)
Constructor.ContentType(org.restlet.data.MediaType mediaType, org.restlet.data.CharacterSet characterSet)
Constructor.ContentType(org.restlet.representation.Representation representation)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.restlet.data.CharacterSet
getCharacterSet()
Returns the character set.org.restlet.data.MediaType
getMediaType()
Returns the media type.static org.restlet.data.CharacterSet
readCharacterSet(java.lang.String contentType)
Parses the given content type header and returns the character set.static org.restlet.data.MediaType
readMediaType(java.lang.String contentType)
Parses the given content type header and returns the media type.java.lang.String
toString()
static java.lang.String
writeHeader(org.restlet.data.MediaType mediaType, org.restlet.data.CharacterSet characterSet)
Writes the HTTP "Content-Type" header.static java.lang.String
writeHeader(org.restlet.representation.Representation representation)
Writes the HTTP "Content-Type" header.
-
-
-
Constructor Detail
-
ContentType
public ContentType(org.restlet.data.MediaType mediaType, org.restlet.data.CharacterSet characterSet)
Constructor.- Parameters:
mediaType
- The media type.characterSet
- The character set.
-
ContentType
public ContentType(org.restlet.representation.Representation representation)
Constructor.- Parameters:
representation
- The representation.
-
ContentType
public ContentType(java.lang.String headerValue)
Constructor.- Parameters:
headerValue
- The "Content-type" header to parse.
-
-
Method Detail
-
readCharacterSet
public static org.restlet.data.CharacterSet readCharacterSet(java.lang.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 org.restlet.data.MediaType readMediaType(java.lang.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 java.lang.String writeHeader(org.restlet.data.MediaType mediaType, org.restlet.data.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 java.lang.String writeHeader(org.restlet.representation.Representation representation)
Writes the HTTP "Content-Type" header.- Parameters:
representation
- The related representation.- Returns:
- The HTTP "Content-Type" header.
-
getCharacterSet
public org.restlet.data.CharacterSet getCharacterSet()
Returns the character set.- Returns:
- The character set.
-
getMediaType
public org.restlet.data.MediaType getMediaType()
Returns the media type.- Returns:
- The media type.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-