NIST-SIP: The Reference Implementation for JAIN-SIP 1.2

gov.nist.javax.sip.header
Class ContentType

java.lang.Object
  extended by gov.nist.core.GenericObject
      extended by gov.nist.javax.sip.header.SIPObject
          extended by gov.nist.javax.sip.header.SIPHeader
              extended by gov.nist.javax.sip.header.ParametersHeader
                  extended by gov.nist.javax.sip.header.ContentType
All Implemented Interfaces:
HeaderExt, SIPHeaderNames, Serializable, Cloneable, ContentTypeHeader, Header, MediaType, Parameters

public class ContentType
extends ParametersHeader
implements ContentTypeHeader

ContentType SIP Header

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
 

Since:
1.1
Version:
1.2, 1.2 $Revision: 1.7 $ $Date: 2009/07/17 18:57:29 $
Author:
M. Ranganathan
, Olivier Deruelle
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface javax.sip.header.ContentTypeHeader
NAME
 
Fields inherited from interface gov.nist.javax.sip.header.SIPHeaderNames
ACCEPT, ACCEPT_ENCODING, ACCEPT_LANGUAGE, ALERT_INFO, ALLOW, ALLOW_EVENTS, AUTHENTICATION_INFO, AUTHORIZATION, CALL_ID, CALL_INFO, CONTACT, CONTENT_DISPOSITION, CONTENT_ENCODING, CONTENT_LANGUAGE, CONTENT_LENGTH, CONTENT_TYPE, CSEQ, DATE, ERROR_INFO, EVENT, EXPIRES, FROM, IN_REPLY_TO, JOIN, MAX_FORWARDS, MIME_VERSION, MIN_EXPIRES, MIN_SE, ORGANIZATION, PRIORITY, PROXY_AUTHENTICATE, PROXY_AUTHORIZATION, PROXY_REQUIRE, RACK, REASON, RECORD_ROUTE, REFERRED_BY, REPLACES, REPLY_TO, REQUIRE, RETRY_AFTER, ROUTE, RSEQ, SERVER, SESSION_EXPIRES, SIP_ETAG, SIP_IF_MATCH, SUBJECT, SUBSCRIPTION_STATE, SUPPORTED, TIMESTAMP, TO, UNSUPPORTED, USER_AGENT, VIA, WARNING, WWW_AUTHENTICATE
 
Constructor Summary
ContentType()
          Default constructor.
ContentType(String contentType, String contentSubtype)
          Constructor given a content type and subtype.
 
Method Summary
 Object clone()
          Clones this object.
 int compareMediaRange(String media)
          compare two MediaRange headers.
 String encodeBody()
          Encode into a canonical string.
 boolean equals(Object other)
          An introspection based equality predicate for SIPObjects.
 String getCharset()
          Get the charset parameter.
 String getContentSubType()
          Get the content subtype.
 String getContentType()
          Get the content subtype.
 MediaRange getMediaRange()
          get the mediaRange field.
 String getMediaSubType()
          get the MediaSubType field.
 String getMediaType()
          get the Media Type.
 void setContentSubType(String contentType)
          Set the content subtype.
 void setContentType(String contentType)
          set the content type.
 void setContentType(String contentType, String contentSubType)
          set the content type and subtype.
 void setMediaRange(MediaRange m)
          Set the mediaRange member
 
Methods inherited from class gov.nist.javax.sip.header.ParametersHeader
getNameValue, getParameter, getParameterNames, getParameters, getParameterValue, hasParameter, hasParameters, removeParameter, removeParameters, setParameter, setParameter, setParameters, setQuotedParameter
 
Methods inherited from class gov.nist.javax.sip.header.SIPHeader
encode, encode, getHeaderName, getHeaderValue, getName, getValue, hashCode, isHeaderList, setHeaderName, toString
 
Methods inherited from class gov.nist.javax.sip.header.SIPObject
dbgPrint, debugDump, debugDump, match
 
Methods inherited from class gov.nist.core.GenericObject
getClassFromName, getMatcher, isMySubclass, makeClone, merge, setMatcher
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.sip.header.Parameters
getParameter, getParameterNames, removeParameter, setParameter
 
Methods inherited from interface javax.sip.header.Header
getName, hashCode, toString
 

Constructor Detail

ContentType

public ContentType()
Default constructor.


ContentType

public ContentType(String contentType,
                   String contentSubtype)
Constructor given a content type and subtype.

Parameters:
contentType - is the content type.
contentSubtype - is the content subtype
Method Detail

compareMediaRange

public int compareMediaRange(String media)
compare two MediaRange headers.

Parameters:
media - String to set
Returns:
int.

encodeBody

public String encodeBody()
Encode into a canonical string.

Returns:
String.

getMediaRange

public MediaRange getMediaRange()
get the mediaRange field.

Returns:
MediaRange.

getMediaType

public String getMediaType()
get the Media Type.

Returns:
String.

getMediaSubType

public String getMediaSubType()
get the MediaSubType field.

Returns:
String.

getContentSubType

public String getContentSubType()
Get the content subtype.

Specified by:
getContentSubType in interface MediaType
Returns:
the content subtype string (or null if not set).

getContentType

public String getContentType()
Get the content subtype.

Specified by:
getContentType in interface MediaType
Returns:
the content tyep string (or null if not set).

getCharset

public String getCharset()
Get the charset parameter.


setMediaRange

public void setMediaRange(MediaRange m)
Set the mediaRange member

Parameters:
m - mediaRange field.

setContentType

public void setContentType(String contentType,
                           String contentSubType)
set the content type and subtype.

Parameters:
contentType - Content type string.
contentSubType - content subtype string

setContentType

public void setContentType(String contentType)
                    throws ParseException
set the content type.

Specified by:
setContentType in interface MediaType
Parameters:
contentType - Content type string.
Throws:
ParseException - which signals that an error has been reached unexpectedly while parsing the contentType value.

setContentSubType

public void setContentSubType(String contentType)
                       throws ParseException
Set the content subtype.

Specified by:
setContentSubType in interface MediaType
Parameters:
contentType - String to set
Throws:
ParseException - which signals that an error has been reached unexpectedly while parsing the contentSubType value.

clone

public Object clone()
Description copied from class: gov.nist.core.GenericObject
Clones this object.

Specified by:
clone in interface Header
Overrides:
clone in class ParametersHeader
Returns:
a deep copy of Header

equals

public boolean equals(Object other)
Description copied from class: SIPObject
An introspection based equality predicate for SIPObjects.

Specified by:
equals in interface Header
Overrides:
equals in class SIPObject
Parameters:
other - the other object to test against.
Returns:
true if the objects are euqal and false otherwise

NIST-SIP: The Reference Implementation for JAIN-SIP 1.2

A product of the NIST/ITL Advanced Networking Technologies Division.
See conditions of use.
Submit a bug report or feature request.