public abstract class SipServlet
extends javax.servlet.GenericServlet
This class receives incoming messages through the
service
method. This method calls
doRequest
or doResponse
for incoming requests and responses, respectively. These two methods
in turn dispatch on request method or status code to one of the
following methods:
doInvite
- for SIP INVITE requests
doAck
- for SIP ACK requests
doOptions
- for SIP OPTIONS requests
doBye
- for SIP BYE requests
doCancel
- for SIP CANCEL requests
doRegister
- for SIP REGISTER requests
doSubscribe
- for SIP SUBSCRIBE requests
doNotify
- for SIP NOTIFY requests
doMessage
- for SIP MESSAGE requests
doInfo
- for SIP INFO requests
doPrack
- for SIP PRACK requests
doUpdate
- for SIP UPDATE requests
doRefer
- for SIP REFER requests
doPublish
- for SIP PUBLISH requests
doProvisionalResponse
- for SIP 1xx informational responses except 100.
doSuccessResponse
- for SIP 2xx responses
doRedirectResponse
- for SIP 3xx responses
doErrorResponse
- for SIP 4xx, 5xx, and 6xx responses
The default implementation of doAck
, doCancel
and all the response handling methods are empty. All other request handling
methods reject the request with a 500 error response.
Subclasses of SipServlet
will usually override one
or more of these methods.
Modifier and Type | Field and Description |
---|---|
static String |
DNS_RESOLVER
The string "javax.servlet.sip.DnsResolver".
|
static String |
OUTBOUND_ADDRESSES
The string "javax.servlet.sip.outboundAddresses".
|
static String |
OUTBOUND_INTERFACES
The string "javax.servlet.sip.outboundInterfaces".
|
static String |
PRACK_SUPPORTED
Deprecated.
in favor of using the "javax.servlet.sip.supported" attribute
|
static String |
SIP_APPLICATIONSESSION_CREATE
The string "javax.servlet.sip.ApplicationSession.create".
|
static String |
SIP_APPLICATIONSESSION_ID
The string "javax.servlet.sip.ApplicationSessionId".
|
static String |
SIP_APPLICATIONSESSION_KEY
The string "javax.servlet.sip.ApplicationSessionKey".
|
static String |
SIP_FACTORY
The string "javax.servlet.sip.SipFactory".
|
static String |
SIP_SESSIONS_UTIL
The string "javax.servlet.sip.SipSessionsUtil".
|
static String |
SUPPORTED
The string "javax.servlet.sip.supported".
|
static String |
SUPPORTED_RFCs
The string "javax.servlet.sip.supportedRfcs".
|
static String |
TIMER_SERVICE
The string "javax.servlet.sip.TimerService".
|
Constructor and Description |
---|
SipServlet() |
Modifier and Type | Method and Description |
---|---|
protected void |
doAck(SipServletRequest req)
Invoked by the server (via the service method) to handle incoming
ACK requests.
|
protected void |
doBranchResponse(SipServletResponse resp)
Invoked by the server to handle intermediate final responses only if this
Servlet behaves as a proxy.
|
protected void |
doBye(SipServletRequest req)
Invoked by the server (via the service method) to handle incoming
BYE requests.
|
protected void |
doCancel(SipServletRequest req)
Invoked by the server (via the service method) to handle incoming
CANCEL requests.
|
protected void |
doErrorResponse(SipServletResponse resp)
Invoked by the server (via the doResponse method) to handle incoming
4xx - 6xx class responses.
|
protected void |
doInfo(SipServletRequest req)
Invoked by the server (via the service method) to handle incoming
INFO requests.
|
protected void |
doInvite(SipServletRequest req)
Invoked by the server (via the service method) to handle incoming
INVITE requests.
|
protected void |
doMessage(SipServletRequest req)
Invoked by the server (via the service method) to handle incoming
MESSAGE requests.
|
protected void |
doNotify(SipServletRequest req)
Invoked by the server (via the service method) to handle incoming
NOTIFY requests.
|
protected void |
doOptions(SipServletRequest req)
Invoked by the server (via the service method) to handle incoming
OPTIONS requests.
|
protected void |
doPrack(SipServletRequest req)
Invoked by the server (via the service method) to handle incoming
PRACK requests.
|
protected void |
doProvisionalResponse(SipServletResponse resp)
Invoked by the server (via the doResponse method) to handle incoming
1xx class responses except 100.
|
protected void |
doPublish(SipServletRequest req)
Invoked by the server (via the service method) to handle incoming
PUBLISH requests.
|
protected void |
doRedirectResponse(SipServletResponse resp)
Invoked by the server to notify the servlet of incoming 3xx class
responses.
|
protected void |
doRefer(SipServletRequest req)
Invoked by the server (via the service method) to handle incoming
REFER requests.
|
protected void |
doRegister(SipServletRequest req)
Invoked by the server (via the service method) to handle incoming
REGISTER requests.
|
protected void |
doRequest(SipServletRequest req)
Invoked to handle incoming requests.
|
protected void |
doResponse(SipServletResponse resp)
Invoked to handle incoming responses.
|
protected void |
doSubscribe(SipServletRequest req)
Invoked by the server (via the service method) to handle incoming
SUBSCRIBE requests.
|
protected void |
doSuccessResponse(SipServletResponse resp)
Invoked by the server (via the doResponse method) to handle incoming
2xx class responses.
|
protected void |
doUpdate(SipServletRequest req)
Invoked by the server (via the service method) to handle incoming
UPDATE requests.
|
void |
log(String message)
Writes the specified message to a servlet log file.
|
void |
log(String message,
Throwable t)
Writes an explanatory message and a stack trace for a given
Throwable exception to the servlet log file. |
void |
service(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse resp)
Invoked to handle incoming SIP messages: requests or responses.
|
public static final String SIP_FACTORY
ServletContext
attribute whose value is an
instance of the SipFactory
interface.SipFactory
,
Constant Field Valuespublic static final String TIMER_SERVICE
ServletContext
attribute whose value is an
instance of the TimerService
interface.TimerService
,
Constant Field Valuespublic static final String DNS_RESOLVER
ServletContext
attribute whose value is an
instance of the DnsResolver
interface.DnsResolver
,
Constant Field Valuespublic static final String SUPPORTED
ServletContext
attribute whose value is a
List
containing the names of SIP extensions supported
by the container.public static final String SUPPORTED_RFCs
ServletContext
attribute whose value is a
List
containing the RFC numbers represented as Strings
of SIP RFCs supported by the container.
For e.g., if the container supports RFC 3261, RFC 3262 and RFC 3265, the
List associated with this attribute should contain the Strings "3261",
"3262" and "3265".public static final String OUTBOUND_INTERFACES
ServletContext
attribute whose value is a list
of SipURI
objects which represent the available outbound
interfaces for sending SIP requests. On a multihomed machine, a specific
outbound interface can be selected for sending requests by calling the
the SipSession.setOutboundInterface(java.net.InetSocketAddress)
or Proxy.setOutboundInterface(java.net.InetSocketAddress)
with an available interface address chosen from this list.public static final String OUTBOUND_ADDRESSES
ServletContext
attribute whose value is a list
of InetAddress
objects which represent the available outbound
interfaces for sending SIP requests. On a multihomed machine, a specific
outbound interface can be selected for sending requests by calling the
the SipSession.setOutboundInterface(java.net.InetSocketAddress)
or Proxy.setOutboundInterface(java.net.InetSocketAddress)
with an available interface address chosen from this list.public static final String SIP_SESSIONS_UTIL
ServletContext
attribute whose value is the @{link Sessions}
utility class providing support for converged SIP/HTTP applications.public static final String PRACK_SUPPORTED
ServletContext
attribute whose value suggests whether
the container supports the 100rel extension i.e. RFC 3262.public static final String SIP_APPLICATIONSESSION_KEY
public static final String SIP_APPLICATIONSESSION_ID
public static final String SIP_APPLICATIONSESSION_CREATE
public void service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse resp) throws javax.servlet.ServletException, IOException
This method dispatched to doRequest()
or
doResponse()
as appropriate. Servlets will not
usually need to override this method.
service
in interface javax.servlet.Servlet
service
in class javax.servlet.GenericServlet
req
- the request to handle, or null if the triggering event
was an incoming responseresp
- incoming response or null if the triggering event was
an incoming requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationIOException
- if an input or output exception occursprotected void doRequest(SipServletRequest req) throws javax.servlet.ServletException, IOException
req
- represents the incoming SIP requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationIOException
- if an input or output exception occursprotected void doInvite(SipServletRequest req) throws javax.servlet.ServletException, IOException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming SIP INVITE requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationIOException
- if an input or output exception occursprotected void doAck(SipServletRequest req) throws javax.servlet.ServletException, IOException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming SIP ACK requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationIOException
- if an input or output exception occursprotected void doOptions(SipServletRequest req) throws javax.servlet.ServletException, IOException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming SIP OPTIONS requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationIOException
- if an input or output exception occursprotected void doBye(SipServletRequest req) throws javax.servlet.ServletException, IOException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming SIP BYE requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationIOException
- if an input or output exception occursprotected void doCancel(SipServletRequest req) throws javax.servlet.ServletException, IOException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming SIP CANCEL requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationIOException
- if an input or output exception occursprotected void doRegister(SipServletRequest req) throws javax.servlet.ServletException, IOException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming SIP REGISTER requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationIOException
- if an input or output exception occursprotected void doSubscribe(SipServletRequest req) throws javax.servlet.ServletException, IOException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming SIP SUBSCRIBE requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationIOException
- if an input or output exception occursprotected void doNotify(SipServletRequest req) throws javax.servlet.ServletException, IOException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming SIP NOTIFY requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationIOException
- if an input or output exception occursprotected void doMessage(SipServletRequest req) throws javax.servlet.ServletException, IOException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming SIP MESSAGE requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationIOException
- if an input or output exception occursprotected void doInfo(SipServletRequest req) throws javax.servlet.ServletException, IOException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming SIP INFO requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationIOException
- if an input or output exception occursprotected void doPrack(SipServletRequest req) throws javax.servlet.ServletException, IOException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming SIP PRACK requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationIOException
- if an input or output exception occursprotected void doUpdate(SipServletRequest req) throws javax.servlet.ServletException, IOException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming SIP UPDATE requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationIOException
- if an input or output exception occursprotected void doRefer(SipServletRequest req) throws javax.servlet.ServletException, IOException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming SIP REFER requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationIOException
- if an input or output exception occursprotected void doPublish(SipServletRequest req) throws javax.servlet.ServletException, IOException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming SIP PUBLISH requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationIOException
- if an input or output exception occursprotected void doResponse(SipServletResponse resp) throws javax.servlet.ServletException, IOException
doProvisionalResponse()
,
doSuccessResponse()
,
doBranchResponse()
,
doRedirectResponse()
or
doErrorResponse()
.
Intermediate final responses received on a ProxyBranch are dispatched to
doBranchResponse(javax.servlet.sip.SipServletResponse)
. To handle such responses override the
doBranchResponse.
Servlets will not usually need to override this method.
resp
- the response objectjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationIOException
- if an input or output exception occursSipServletResponse.isBranchResponse()
protected void doProvisionalResponse(SipServletResponse resp) throws javax.servlet.ServletException, IOException
The default implementation is empty and must be overridden by subclasses to do something useful.
resp
- the response objectjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationIOException
- if an input or output exception occursprotected void doSuccessResponse(SipServletResponse resp) throws javax.servlet.ServletException, IOException
The default implementation is empty and must be overridden by subclasses to do something useful.
resp
- the response objectjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationIOException
- if an input or output exception occursprotected void doRedirectResponse(SipServletResponse resp) throws javax.servlet.ServletException, IOException
The default implementation is empty and must be overridden by subclasses to do something useful.
resp
- the response objectjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationIOException
- if an input or output exception occursprotected void doErrorResponse(SipServletResponse resp) throws javax.servlet.ServletException, IOException
The default implementation is empty and must be overridden by subclasses to do something useful.
resp
- the response objectjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationIOException
- if an input or output exception occursprotected void doBranchResponse(SipServletResponse resp) throws javax.servlet.ServletException, IOException
The default implementation is empty and must be overridden by subclasses to handle intermediate final responses received on a ProxyBranch.
resp
- the response objectjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationIOException
- if an input or output exception occurspublic void log(String message)
log
in class javax.servlet.GenericServlet
message
- a String
specifying the message to be
written to the log filepublic void log(String message, Throwable t)
Throwable
exception to the servlet log file. See
ServletContext.log(String, Throwable)
.log
in class javax.servlet.GenericServlet
message
- a String
that describes the error
or exceptiont
- the java.lang.Throwable
error or exceptionCopyright © 1996-2015, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.