Oracle Server E10293-02 ユーザーズマニュアル
Classes and Methods
2-12 Oracle Communication and Mobility Server Developer’s Guide
■
Dialog-related information such as tags, contacts, and CSeq in the SIP messages
are handled automatically.
are handled automatically.
■
On outgoing requests, OCMS performs DNS lookups and supports NAPTR-,
SRV-, and A-records (according to RFC 3263).
SRV-, and A-records (according to RFC 3263).
Storing Data as Session Attributes
The SIP Servlet API enables data to be stored as session attributes. Session attributes
can be used to store session specific data to be used in responses and subsequent
requests or from a listener class. The attributes are stored and accessed through setters
and getters directly on the session object. The session can be either a SipSession or a
SipApplicationSession
can be used to store session specific data to be used in responses and subsequent
requests or from a listener class. The attributes are stored and accessed through setters
and getters directly on the session object. The session can be either a SipSession or a
SipApplicationSession
. An attribute can only be retrieved from the same session
it was set. For example:
session.setAttribute("key", "value");
session.getAttribute("key"); // Will return "value"
session.removeAttribute("key");
Although the session attributes can store any object, the attributes and their keys must
be serializable for applications that are distributable (for High Availability). Use the
getAttributeNames
be serializable for applications that are distributable (for High Availability). Use the
getAttributeNames
method to retrieve all of the set attributes. For example:
Enumeration attributes = session.getAttributeNames();
String attributeName = null;
while (attributes.hasMoreElements())
{
attributeName = (String) attributes.nextElement();
Object attribute = session.getAttribute(attributeName);
log (attribute.toString());
}
Adding Configuration Parameters
A servlet can be configured by adding parameters to the <servlet> section in the SIP
Servlet application descriptor (sip.xml). The servlet can then access these parameters
through the getInitParameter method.
Servlet application descriptor (sip.xml). The servlet can then access these parameters
through the getInitParameter method.
illustrates how to configure
the response code.
Example 2–5 Configuring Servlet Parameters
package com.mydomain.test;
import javax.servlet.sip.SipServlet;
import javax.servlet.sip.SipServletRequest;
import javax.servlet.sip.SipServletResponse;
import java.io.IOException;
public class MySipServlet extends SipServlet
{
protected void doRequest(SipServletRequest req) throws IOException
{
int responseCode = Integer.parseInt(getInitParameter("responseCode"));
SipServletResponse resp = req.createResponse(responseCode);
resp.send();
}
}