jain.protocol.ip.sip.header
Class AcceptHeader

java.lang.Object
  |
  +--jain.protocol.ip.sip.header.Header
        |
        +--jain.protocol.ip.sip.header.GeneralHeader
              |
              +--jain.protocol.ip.sip.header.AcceptHeader

public final class AcceptHeader
extends GeneralHeader

This class represents an Accept request-header. It can be used in to specify media-ranges which are acceptable for the response. AcceptHeaders can be used to indicate that the request is specifically limited to a small set of desired types. The specification of the acceptable media is split into type and subtype.

An AcceptHeader may be followed by one or more parameters applicable to the media-range. Q-values allow the user to indicate the relative degree of preference for that media-range, using the qvalue scale from 0 to 1. (If no q-value is present, the media-range should be treated as having a q-value of 1.)

If no AcceptHeader is present in a RequestMessage, then it is assumed that the client accepts media of type "application" and subType "sdp". If an AcceptHeader is present, and if the server cannot send a response which is acceptable according to the combined Accept field value, then the server should send a ResponseMessage with a CLIENT_ERROR_NOT_ACCEPTABLE response code.

Version:
0.6

Field Summary
static java.lang.String token
          Token of AcceptHeader
 
Fields inherited from class jain.protocol.ip.sip.header.Header
ENTITY_HEADER, GENERAL_HEADER, REQUEST_HEADER, RESPONSE_HEADER
 
Constructor Summary
AcceptHeader(java.lang.String type, java.lang.String subType)
          Creates an AcceptHeader based on the specified type and subType
 
Method Summary
 boolean allowsAllSubTypes()
          Gets boolean value to indicate if the AcceptHeader allows all media sub-types
 boolean allowsAllTypes()
          Gets boolean value to indicate if the AcceptHeader allows all media types
 java.lang.Object clone()
          Creates and returns a copy of AcceptHeader
 boolean equals(AcceptHeader acceptHeader)
          Indicates whether some other AcceptHeader is "equal to" this one
 java.lang.String getExtension(java.lang.String extension)
          Gets the value of specified extension parameter in AcceptHeader
 java.lang.String[] getExtensions()
          Gets an array of the names of AcceptHeader's extension parameters
 java.lang.String getMediaRange()
          Gets string representation of media-range of AcceptHeader
 float getQValue()
          Gets q-value of media-range in AcceptHeader
 java.lang.String getSubType()
          Gets the media sub-type of AcceptHeader
 java.lang.String getType()
          Gets the media type of AcceptHeader
 java.lang.String getValue()
          Gets value of AcceptHeader
 boolean hasExtension(java.lang.String extension)
          Gets boolean value to indicate if the AcceptHeader has specified extension parameter
 boolean hasExtensions()
          Gets boolean value to indicate if the AcceptHeader has extension parameters
 boolean hasQValue()
          Gets boolean value to indicate if the AcceptHeader has a q-value
 void removeExtension(java.lang.String extension)
          Removes specified extension parameter from AcceptHeader
 void removeExtensions()
          Removes all extension parameters from AcceptHeader
 void removeQValue()
          Removes q-value of media-range in AcceptHeader
 void setExtension(java.lang.String extension, java.lang.String value)
          Sets value of extension parameter to value in AcceptHeader
 void setQValue(float qValue)
          Sets q-value for media-range in AcceptHeader Q-values allow the user to indicate the relative degree of preference for that media-range, using the qvalue scale from 0 to 1.
 void setSubType(java.lang.String subType)
          Sets value of media sub-type in AcceptHeader
 void setType(java.lang.String type)
          Sets value of media type in AcceptHeader
 
Methods inherited from class jain.protocol.ip.sip.header.Header
equals, getHeaderType, getToken, setValue, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

token

public static final java.lang.String token
Token of AcceptHeader
Constructor Detail

AcceptHeader

public AcceptHeader(java.lang.String type,
                    java.lang.String subType)
             throws java.lang.IllegalArgumentException
Creates an AcceptHeader based on the specified type and subType
Parameters:
type - media type
subType - media sub-type
Throws:
java.lang.IllegalArgumentException - if type or sub-type is zero-length
Method Detail

getType

public java.lang.String getType()
Gets the media type of AcceptHeader
Returns:
media type of AcceptHeader

getSubType

public java.lang.String getSubType()
Gets the media sub-type of AcceptHeader
Returns:
media sub-type of AcceptHeader

getExtension

public java.lang.String getExtension(java.lang.String extension)
                              throws ParameterNotSetException
Gets the value of specified extension parameter in AcceptHeader
Parameters:
extension - extension parameter to retrieve
Returns:
the value of specified extension parameter in AcceptHeader
Throws:
ParameterNotSetException - if the extension parameter does not exist

getExtensions

public java.lang.String[] getExtensions()
                                 throws ParameterNotSetException
Gets an array of the names of AcceptHeader's extension parameters
Returns:
an array of the names of AcceptHeader's extension parameters
Throws:
ParameterNotSetException - if AcceptHeader has no extension parameters

getMediaRange

public java.lang.String getMediaRange()
Gets string representation of media-range of AcceptHeader
Returns:
string representation of media-range of AcceptHeader

hasExtensions

public boolean hasExtensions()
Gets boolean value to indicate if the AcceptHeader has extension parameters
Returns:
boolean value to indicate if the AcceptHeader has extension parameters

hasExtension

public boolean hasExtension(java.lang.String extension)
Gets boolean value to indicate if the AcceptHeader has specified extension parameter
Returns:
boolean value to indicate if the AcceptHeader has specified extension parameter

hasQValue

public boolean hasQValue()
Gets boolean value to indicate if the AcceptHeader has a q-value
Returns:
boolean value to indicate if the AcceptHeader has a q-value

allowsAllTypes

public boolean allowsAllTypes()
Gets boolean value to indicate if the AcceptHeader allows all media types
Returns:
boolean value to indicate if the AcceptHeader allows all media types

allowsAllSubTypes

public boolean allowsAllSubTypes()
Gets boolean value to indicate if the AcceptHeader allows all media sub-types
Returns:
boolean value to indicate if the AcceptHeader allows all media sub-types

setSubType

public void setSubType(java.lang.String subType)
                throws java.lang.IllegalArgumentException
Sets value of media sub-type in AcceptHeader
Parameters:
subType - media sub-type
Throws:
java.lang.IllegalArgumentException - if sub-type is null or zero-length

setType

public void setType(java.lang.String type)
             throws java.lang.IllegalArgumentException
Sets value of media type in AcceptHeader
Parameters:
type - media type
Throws:
java.lang.IllegalArgumentException - if type is null or zero-length

setExtension

public void setExtension(java.lang.String extension,
                         java.lang.String value)
Sets value of extension parameter to value in AcceptHeader
Parameters:
extension - name of extension parameter
value - value of extension parameter
Throws:
java.lang.IllegalArgumentException - if extension or value are null or zero-length

setQValue

public void setQValue(float qValue)
               throws java.lang.IllegalArgumentException
Sets q-value for media-range in AcceptHeader Q-values allow the user to indicate the relative degree of preference for that media-range, using the qvalue scale from 0 to 1. (If no q-value is present, the media-range should be treated as having a q-value of 1.)
Parameters:
qValue - q-value betwwen 0 and 1
Throws:
java.lang.IllegalArgumentException - if qValue is not between 0 and 1

getQValue

public float getQValue()
                throws ParameterNotSetException
Gets q-value of media-range in AcceptHeader
Returns:
q-value of media-range
Throws:
ParameterNotSetException - if no q-value exists

removeExtension

public void removeExtension(java.lang.String extension)
Removes specified extension parameter from AcceptHeader
Parameters:
extension - extension parameter to remove from AcceptHeader

removeExtensions

public void removeExtensions()
Removes all extension parameters from AcceptHeader

removeQValue

public void removeQValue()
Removes q-value of media-range in AcceptHeader

getValue

public java.lang.String getValue()
Gets value of AcceptHeader
Overrides:
getValue in class Header
Returns:
value of AcceptHeader

clone

public java.lang.Object clone()
Creates and returns a copy of AcceptHeader
Overrides:
clone in class Header
Returns:
copy of AcceptHeader

equals

public boolean equals(AcceptHeader acceptHeader)
Indicates whether some other AcceptHeader is "equal to" this one
Parameters:
acceptHeader - the AcceptHeader with which to compare


If you have any comments or queries, please mail them to JAIN-SIP-interest@sun.com


Copyright - 2000 Sun Microsystems