Oracle Server E10293-02 ユーザーズマニュアル

ページ / 108
Classes and Methods
2-10  Oracle Communication and Mobility Server Developer’s Guide
method that returns an iterator of the SIP headers of the message. The setHeader 
method sets or adds an address for a header. Specifying the name of the header in 
getHeaders(name)
 method returns another iterator of String objects containing all 
of the values for that header.
For those headers that conform to AddressHeader, the getAddressHeader(name) 
method will return the header parsed as an Address object.
Addresses can be added or set for a header by using setAddressHeader(name, 
address)
, addAddressHeader(name, address, first), where name is the 
name of the header, the address to add, and first is a Boolean. If first is set to true, then 
the address will be added first, otherwise it will be added last.
 shows how to manipulate SIP headers:
Example 2–2  Manipulating SIP Headers
javax.servlet.sip.SipServletRequest req;
// Set a header with the given name and value.
// Overwrites any previous header values.
req.setHeader("Accept", "application/sdp");
// Add a header value to the end of a header
req.addHeader("Accept", "text/html");
// Clear all header values
req.removeHeader("Accept");
// Add a Route header value ahead of the existing Route header
// values.
req.pushRoute(sipURI);
// Get the first route as an Address object
Address first route = req.getAddressHeader("Route");
// Get all address header fields for a header
Iterator addrIter = req.getAddressHeaders("Route");
while (addrIter.hasNext()) 
{
Address addr = (Address) addrIter.next();
// ...
}
SipURI
A base class javax.servlet.sip.URI exists with two sub classes, 
javax.servlet.sip.SipURI
 and javax.servlet.sip.TelURL which 
represents SIP URIs and TEL URLs according to RFC 3261, and URLs defined by  
RFC 2806. The Address class stores a SipURI or a TelURL as the address of the user.
URIs can be described as user@host, where the user part is either a user name or a 
telephone number, and the host is a domain name or an IP address.
Parameters can be accessed with getters and setters. The getParameterNames 
method will return an iterator with the names of the parameters. A parameter can be 
accessed either with the general getParameter method or with specific parameter 
methods like getUser, getHost and getLrParam, which returns the user, the host, 
and true if the loose route, lr is set. Parameters can be set with its corresponding 
setMethod()
 as shown in