Corporation Server User Manual
Configuring SIP Applications in sip.xml
2-14 Oracle Communication and Mobility Server Developer’s Guide
Defining a Servlet
The <servlet> element defines the SIP container’s servlets. A servlet requires a
servlet name <servlet-name>, and a servlet class, <servlet-class>. The name
must be unique within the application and the class must be the fully qualified name
of the servlet class, as illustrated in
Example 2–7.
Example 2–7 Servlet Name and Servlet Class
<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>com.company.example.MyServlet</servlet-class>
</servlet>
A servlet can also have its own init parameters, <init-param> and a description
<description>. When the container starts, it only instantiates and calls the init()
method for the servlets which have set the <load-on-startup> element, as shown
in
Example 2–8.
Example 2–8 Defining a Servlet
<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>com.mydomain.test.MySipServlet</servlet-class>
<init-param>
<param-name>logging</param-name>
<param-value>true</param-value>
<description>
Set if logging should be switched on (true) or not (false).
</description>
</init-param>
<init-param>
<param-name>infotainment</param-name>
<param-value>http://www.infotainmentsite.com</param-value>
<description>
The site to use as the infotainment content provider.
</description>
</init-param>
<load-on-startup/>
</servlet>
Defining the Servlet Mapping
The <servletmapping> element of the SIP servlet application deployment
descriptor defines the conditions for invoking a servlet.
Example 2–9 illustrates how a
servlet named MySipServlet can only be invoked for incoming MESSAGE requests. For
more information, see
"Servlet Mapping".
Example 2–9 Servlet Mapping
<!-- Servlet Mappings for incoming requests-->
<servlet-mapping>
<servlet-name>My Sip Servlet</servlet-name>
<pattern>
<equal>
<var>request.method</var>
<value>MESSAGE</value>
</equal>
</pattern>
</servlet-mapping>