Oracle Server E10293-02 Manuel D’Utilisation
Classes and Methods
SIP Servlets 2-9
A SIP request consists of the following:
■
Request line
■
Headers
■
Empty line
■
Message body
All parts of the SIP request for instance request URI, headers and parameters are
accessible through these interfaces. The SIP container handles many of these system
headers. Applications must not add, delete, or modify the following system headers:
accessible through these interfaces. The SIP container handles many of these system
headers. Applications must not add, delete, or modify the following system headers:
■
From
■
To
■
Call ID
■
CSeq
■
Via
■
Route (except through pushRoute)
■
Record Route
■
Contact (Contact is a system header field in messages other than REGISTER
requests and responses, as well as 3xx and 485 responses)
requests and responses, as well as 3xx and 485 responses)
Responses
Responses to incoming requests are created using the createResponse method on
the request object. It will automatically create a response with all SIP headers set
according to the request. A SIP response has the same structure as a SIP request,
except for a Status line instead of a request line. When receiving responses through, for
instance the doResponse method, methods like getStatus() can be used on the
response object to decide what action to take.
the request object. It will automatically create a response with all SIP headers set
according to the request. A SIP response has the same structure as a SIP request,
except for a Status line instead of a request line. When receiving responses through, for
instance the doResponse method, methods like getStatus() can be used on the
response object to decide what action to take.
Content
Example 2–1 Setting the Content of a Request with the setConent Method
// Copy of the content from request A to request B
requestB.setContent(requestA.getContent(),
requestA.getContentType());
// Create new content
{
try
req.setContent("Hello!", "text/plain");
}
catch (UnsupportedEncodingException e)
{
// Handle the exception
}
Manipulating SIP headers
The javax.servlet.sip.SipServletMessage includes methods for
manipulating SIP headers. The getHeaderNames() method is the most general
manipulating SIP headers. The getHeaderNames() method is the most general