|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.servlet.GenericServlet | +--javax.servlet.sip.SipServlet
Provides an abstract class to be subclassed to create a SIP servlet.
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
doProvisionalResponse
- for SIP 1xx informational responses
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.
Constructor Summary | |
SipServlet()
|
Method Summary | |
protected void |
doAck(SipServletRequest req)
Invoked by the server (via the service method) to handle incoming ACK requests. |
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 |
doProvisionalResponse(SipServletResponse resp)
Invoked by the server (via the doResponse method) to handle incoming 1xx class responses. |
protected void |
doRedirectResponse(SipServletResponse resp)
Invoked by the server to notify the servlet of incoming 3xx class responses. |
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. |
void |
log(java.lang.String message)
Writes the specified message to a servlet log file. |
void |
log(java.lang.String message,
java.lang.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. |
Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SipServlet()
Method Detail |
public void service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse resp) throws javax.servlet.ServletException
This method dispatched to doRequest()
or
doResponse()
as appropriate. Servlets will not
usually need to override this method.
When this method is is invoked to handle an incoming request, both the request and response objects are non-null. The request object represents the incoming request and is immutable. The response object acts as a response "template" and can be used to send back a number of informational responses and a single final response in case this SipServlet acts as a UAS.
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 operationprotected void doRequest(SipServletRequest req) throws javax.servlet.ServletException
req
- represents the incoming SIP request and is immutablejavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationprotected void doInvite(SipServletRequest req) throws javax.servlet.ServletException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming, immutable SIP INVITE requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationprotected void doAck(SipServletRequest req) throws javax.servlet.ServletException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming, immutable SIP ACK requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationprotected void doOptions(SipServletRequest req) throws javax.servlet.ServletException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming, immutable SIP OPTIONS requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationprotected void doBye(SipServletRequest req) throws javax.servlet.ServletException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming, immutable SIP BYE requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationprotected void doCancel(SipServletRequest req) throws javax.servlet.ServletException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming, immutable SIP CANCEL requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationprotected void doRegister(SipServletRequest req) throws javax.servlet.ServletException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming, immutable SIP REGISTER requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationprotected void doSubscribe(SipServletRequest req) throws javax.servlet.ServletException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming, immutable SIP SUBSCRIBE requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationprotected void doNotify(SipServletRequest req) throws javax.servlet.ServletException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming, immutable SIP NOTIFY requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationprotected void doMessage(SipServletRequest req) throws javax.servlet.ServletException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming, immutable SIP MESSAGE requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationprotected void doInfo(SipServletRequest req) throws javax.servlet.ServletException
The default implementation is empty and must be overridden by subclasses to do something useful.
req
- represents the incoming, immutable SIP INFO requestjavax.servlet.ServletException
- if an exception occurs that interferes
with the servlet's normal operationprotected void doResponse(SipServletResponse resp) throws javax.servlet.ServletException
doProvisionalResponse()
,
doErrorResponse()
,
doSuccessResponse()
.
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 operationprotected void doProvisionalResponse(SipServletResponse resp) throws javax.servlet.ServletException
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 operationprotected void doSuccessResponse(SipServletResponse resp) throws javax.servlet.ServletException
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 operationprotected void doRedirectResponse(SipServletResponse resp) throws javax.servlet.ServletException
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 operationprotected void doErrorResponse(SipServletResponse resp) throws javax.servlet.ServletException
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 operationpublic void log(java.lang.String message)
log
in class javax.servlet.GenericServlet
msg
- a String
specifying the message to be
written to the log filepublic void log(java.lang.String message, java.lang.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 exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |