NIST SIP Parser and Stack (v1.2) API

gov.nist.javax.sip.header
Class ContentLength

java.lang.Object
  |
  +--gov.nist.core.GenericObject
        |
        +--gov.nist.javax.sip.header.SIPObject
              |
              +--gov.nist.javax.sip.header.SIPHeader
                    |
                    +--gov.nist.javax.sip.header.ContentLength
All Implemented Interfaces:
Cloneable, ContentLengthHeader, Header, Serializable, SIPHeaderNames

public class ContentLength
extends SIPHeader
implements ContentLengthHeader

ContentLength SIPHeader (of which there can be only one in a SIPMessage).

Fielding, et al.            Standards Track                   [Page 119]
RFC 2616                        HTTP/1.1                       June 1999


      14.13 Content-Length

   The Content-Length entity-header field indicates the size of the
   entity-body, in decimal number of OCTETs, sent to the recipient or,
   in the case of the HEAD method, the size of the entity-body that
   would have been sent had the request been a GET.

       Content-Length    = "Content-Length" ":" 1*DIGIT

   An example is

       Content-Length: 3495

   Applications SHOULD use this field to indicate the transfer-length of
   the message-body, unless this is prohibited by the rules in section
   4.4.

   Any Content-Length greater than or equal to zero is a valid value.
   Section 4.4 describes how to determine the length of a message-body
   if a Content-Length is not given.

   Note that the meaning of this field is significantly different from
   the corresponding definition in MIME, where it is an optional field
   used within the "message/external-body" content-type. In HTTP, it
   SHOULD be sent whenever the message's length can be determined prior
   to being transferred, unless this is prohibited by the rules in
   section 4.4.
 

Author:
M. Ranganathan
, Olivier Deruelle
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface javax.sip.header.ContentLengthHeader
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, MAX_FORWARDS, MIME_VERSION, MIN_EXPIRES, ORGANIZATION, PRIORITY, PROXY_AUTHENTICATE, PROXY_AUTHORIZATION, PROXY_REQUIRE, RACK, REASON, RECORD_ROUTE, REPLY_TO, REQUIRE, RETRY_AFTER, ROUTE, RSEQ, SERVER, SUBJECT, SUBSCRIPTION_STATE, SUPPORTED, TIMESTAMP, TO, UNSUPPORTED, USER_AGENT, VIA, WARNING, WWW_AUTHENTICATE
 
Constructor Summary
ContentLength()
          Default constructor.
ContentLength(int length)
          Constructor given a length.
 
Method Summary
 String encodeBody()
          Encode into a canonical string.
 int getContentLength()
          get the ContentLength field.
 boolean match(Object other)
          Pattern matcher ignores content length.
 void setContentLength(int contentLength)
          Set the contentLength member
 
Methods inherited from class gov.nist.javax.sip.header.SIPHeader
encode, getHeaderName, getHeaderValue, getName, getValue, isHeaderList, setHeaderName
 
Methods inherited from class gov.nist.javax.sip.header.SIPObject
clone, dbgPrint, debugDump, debugDump, equals, merge, replace, replace, replace, replace, toString
 
Methods inherited from class gov.nist.core.GenericObject
getClassFromName, getMatcher, isMySubclass, setMatcher
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.sip.header.Header
clone, equals, getName, toString
 

Constructor Detail

ContentLength

public ContentLength()
Default constructor.


ContentLength

public ContentLength(int length)
Constructor given a length.

Method Detail

getContentLength

public int getContentLength()
get the ContentLength field.

Specified by:
getContentLength in interface ContentLengthHeader
Returns:
int

setContentLength

public void setContentLength(int contentLength)
                      throws InvalidArgumentException
Set the contentLength member

Specified by:
setContentLength in interface ContentLengthHeader
Parameters:
contentLength - int to set
Throws:
InvalidArgumentException - if contentLength is less than zero.

encodeBody

public String encodeBody()
Encode into a canonical string.

Overrides:
encodeBody in class SIPHeader
Returns:
String

match

public boolean match(Object other)
Pattern matcher ignores content length.

Overrides:
match in class SIPObject
Parameters:
other - the match pattern to test against. The match object has to be of the same type (class). Primitive types and non-sip fields that are non null are matched for equality. Null in any field matches anything. Some book-keeping fields are ignored when making the comparison.

NIST SIP Parser and Stack (v1.2) API

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