public interface SipServletRequest extends javax.servlet.ServletRequest, SipServletMessage
SipServletRequest
and passes it to
the handling servlet. For outgoing, locally initiated requests,
applications call SipFactory.createRequest
to obtain a SipServletRequest
that can then be modified and
sent.SipServletMessage.HeaderForm
Modifier and Type | Method and Description |
---|---|
void |
addAuthHeader(SipServletResponse challengeResponse,
AuthInfo authInfo)
This method allows the addition of the appropriate authentication header(s)
to the request that was challenged with a challenge response.
|
void |
addAuthHeader(SipServletResponse challengeResponse,
String username,
String password)
This method allows the addition of the appropriate authentication header(s)
to the request that was challenged with a challenge response without needing the
creation and/or maintenance of the
AuthInfo object. |
SipServletRequest |
createCancel()
Returns a CANCEL request object.
|
InviteBranch |
createInviteBranch()
This method will create a derived session and corresponding invite branch for a received
initial INVITE.
|
SipServletResponse |
createResponse(int statuscode)
Creates a response for this request with the specifies status code.
|
SipServletResponse |
createResponse(int statusCode,
String reasonPhrase)
Creates a response for this request with the specifies status code
and reason phrase.
|
SipServletResponse |
getAcknowledgedResponse()
This method should only be called on an ACK or PRACK message at a UAS or UAC (not a proxy).
|
B2buaHelper |
getB2buaHelper()
Returns the B2buaHelper associated with this request.
|
SipServletResponse |
getFinalResponse()
This method will retrieve the final response that corresponds to the request or null
if there is no such response.
|
String |
getId()
This method will return the id of the request.
|
Address |
getInitialPoppedRoute()
If a top route header had been removed by the container upon
initially receiving this request, then this method can be used to
retrieve it.
|
javax.servlet.ServletInputStream |
getInputStream()
Always returns null.
|
int |
getMaxBreadth()
Returns the value of the Max-Breadth header.
|
int |
getMaxForwards()
Returns the value of the Max-Forwards header.
|
Address |
getPoppedRoute()
If a top route header had been removed by the container upon receiving
this request, then this method can be used to retrieve it.
|
Proxy |
getProxy()
Returns the
Proxy object associated with this request. |
Proxy |
getProxy(boolean create)
Returns the
Proxy object associated with this request. |
BufferedReader |
getReader()
Always returns null.
|
SipApplicationRoutingRegion |
getRegion()
This method allows the application to obtain the region it was
invoked in for this SipServletRequest.
|
URI |
getRequestURI()
Returns the request URI of this request.
|
SipApplicationRoutingDirective |
getRoutingDirective()
Returns the
SipApplicationRoutingDirective associated with
this request. |
URI |
getSubscriberURI()
Returns the URI of the subscriber for which this application
is invoked to serve.
|
boolean |
isInitial()
Returns true if this is an initial request.
|
boolean |
isRequestUriInternal()
If the request-uri of the request is a SIP or SIPS URI and if it is addressed to
the container, this method considers it as internal.
|
void |
pushRoute(Address uri)
Adds a Route header field value to this request with Address argument.
|
void |
pushRoute(SipURI uri)
Adds a Route header field value to this request.
|
void |
send()
Causes this request to be sent.
|
void |
setMaxBreadth(int n)
Sets the value of the Max-Breadth header.
|
void |
setMaxForwards(int n)
Sets the value of the Max-Forwards header.
|
void |
setRequestURI(URI uri)
Sets the request URI of this request.
|
void |
setRoutingDirective(SipApplicationRoutingDirective directive,
SipServletRequest origRequest)
Sets the application routing directive for an outgoing request.
|
getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getDispatcherType, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setAttribute, setCharacterEncoding, startAsync, startAsync
addAcceptLanguage, addAddressHeader, addHeader, addParameterableHeader, getAcceptLanguage, getAcceptLanguages, getAcceptLanguageSet, getAddressHeader, getAddressHeaderList, getAddressHeaders, getApplicationSession, getApplicationSession, getAttributeNames, getCallId, getCharacterEncoding, getContent, getContentLanguage, getContentLength, getContentType, getExpires, getFrom, getHeader, getHeaderForm, getHeaderList, getHeaderNameList, getHeaderNames, getHeaders, getInitialRemoteAddr, getInitialRemotePort, getInitialTransport, getLocalAddr, getLocalPort, getLocalSipWebSocketContext, getMethod, getParameterableHeader, getParameterableHeaderList, getParameterableHeaders, getProtocol, getRawContent, getRemoteAddr, getRemotePort, getRemoteUser, getSession, getSession, getSessionKeepAlivePreference, getTo, getTransport, getUserPrincipal, isCommitted, isInternallyRouted, isSecure, isUserInRole, pushLocalPath, pushPath, removeHeader, setAcceptLanguage, setAddressHeader, setCharacterEncoding, setContent, setContentLanguage, setContentLength, setContentType, setExpires, setHeader, setHeaderForm, setParameterableHeader
clearAttributes, getAttribute, getAttributeNameSet, removeAttribute, setAttribute
URI getRequestURI()
SipServletRequest
void setRequestURI(URI uri)
send
.uri
- new request URI of this SipServletRequest
NullPointerException
- on null uri
void pushRoute(SipURI uri)
This method allows a UAC or a proxy to specify that the request should visit one or more proxies before being delivered to the destination.
uri
- the address that is added as a Route header valuepushRoute(Address)
void pushRoute(Address uri)
This method allows a UAC or a proxy to specify that the request should visit one or more proxies before being delivered to the destination.
uri
- the address that is added as a Route header valuepushRoute(SipURI)
int getMaxForwards()
void setMaxForwards(int n)
This method is equivalent to:
setHeader("Max-Forwards", String.valueOf(n));
n
- new value of the Max-Forwards headerIllegalArgumentException
- if the argument is not in the range
0 to 255int getMaxBreadth()
void setMaxBreadth(int n)
This method is equivalent to:
setHeader("Max-Breadth", String.valueOf(n));
n
- new value of the Max-Breadth headerIllegalArgumentException
- if the argument is not a positive integer.void send() throws IOException
Proxy.proxyTo(javax.servlet.sip.URI)
instead.send
in interface SipServletMessage
InsufficientBreadthException
- If the value of Max-Breadth header
causes the sum of Max-Breadth of active parallel branches to exceed
the Max-Breadth of the original incoming request, when the servlet
act as a B2BUA.IOException
- if a transport error occurs when trying to
send this requestboolean isInitial()
javax.servlet.ServletInputStream getInputStream() throws IOException
Message content can be retrieved using SipServletMessage.getContent()
and SipServletMessage.getRawContent()
.
getInputStream
in interface javax.servlet.ServletRequest
IOException
BufferedReader getReader() throws IOException
Message content can be retrieved using SipServletMessage.getContent()
and SipServletMessage.getRawContent()
.
getReader
in interface javax.servlet.ServletRequest
IOException
Proxy getProxy() throws TooManyHopsException
Proxy
object associated with this request.
A Proxy
instance will be created if one doesn't already
exist. This method behaves the same as getProxy(true)
.
Note that the container must return the same
Proxy
instance whenever a servlet invokes
getProxy
on messages belonging to the same transaction.
In particular, a response to a proxied request is associated with
the same Proxy
object as is the original request.
This method throws an IllegalStateException
if the
Proxy
object didn't already exist and the transaction
underlying this SIP message is in a state which doesn't allow proxying,
for example if this is a SipServletRequest
for which a
final response has already been generated.
If the request contains a Max-Forwards header field value of 0,
then this method will generate a 483 (Too many hops) error response
and throw TooManyHopsException
.
Proxy
object associated with this requestTooManyHopsException
- if the request has a Max-Forwards
header field value of 0.IllegalStateException
- if the transaction underlying this
message isn't already associated with a Proxy
object and its state disallows proxying to be initiated,
for example, because a final response has already been generated. Also
if the application previously accessed the B2buaHelper by invoking
getB2buaHelper()
.getProxy(boolean)
Proxy getProxy(boolean create) throws TooManyHopsException
Proxy
object associated with this request.
If no Proxy
object has yet been created for this request,
the create
argument specifies whether a Proxy
object is to be created or not.
Once a Proxy
object has been associated with a request
subsequent invocations of this method will yield the same
Proxy
object, as will the no-argument
getProxy()
method and SipServletResponse.getProxy()
for responses received to proxied requests.
create
- indicates whether the servlet engine should create
a new Proxy
object if one does not already existProxy
object associated with this requestTooManyHopsException
- if this request has a Max-Forwards
header field value of 0.IllegalStateException
- if the transaction has already completedSipServletResponse createResponse(int statuscode)
statuscode
- status code for the responseIllegalArgumentException
- if the statuscode is not a valid
SIP status codeIllegalStateException
- if this request has already been
responded to with a final status codeSipServletResponse createResponse(int statusCode, String reasonPhrase)
statusCode
- status code for the responsereasonPhrase
- reason phrase to appear in response lineIllegalArgumentException
- if the statuscode is not a valid
SIP status codeIllegalStateException
- if this request has already been
responded to with a final status codeSipServletRequest createCancel()
send()
on
it.
Note that proxy applications MUST use Proxy.cancel()
to cancel outstanding branches.
IllegalStateException
- if the transaction state is such that
it doesn't allow a CANCEL request to be sentB2buaHelper getB2buaHelper()
getProxy()
will
result in IllegalStateException.IllegalStateException
- if getProxy() had already been calledAddress getPoppedRoute()
Note that the URI parameters added to the Record-Route header using
Proxy.getRecordRouteURI()
should be retrieved from the URI of
the popped route Address using
poppedRoute.getURI().getParameter()
and not using
poppedRoute.getParameter()
.
Address getInitialPoppedRoute()
getPoppedRoute()
, this method returns the same
value regardless of which application invokes it in the same application
composition chain.
Note that the URI parameters added to the Record-Route header using
Proxy.getRecordRouteURI()
should be retrieved from the URI of
the popped route Address using
initialPoppedRoute.getURI().getParameter()
and not using
initialPoppedRoute.getParameter()
.
void setRoutingDirective(SipApplicationRoutingDirective directive, SipServletRequest origRequest) throws IllegalStateException
By default, a request created by SipFactory.createRequest(SipServletRequest origRequest, boolean sameCallId) continues the application selection process from origRequest, i.e. directive is CONTINUE. A request created by the other SipFactory.createRequest() methods starts the application selection process afresh, i.e. directive is NEW.
This method allows the servlet to assign a routing directive different from the default.
If directive is NEW, origRequest parameter is ignored. If directive is CONTINUE or REVERSE, the parameter origRequest must be an initial request dispatched by the container to this application, i.e. origRequest.isInitial() must be true. This request must be a request created in a new SipSession or from an initial request, and must not have been sent. If any one of these preconditions are not met, the method throws an IllegalStateException.
Note that when a servlet acts as a proxy and calls Proxy.proxyTo() to proxy a request, the request is always a continuation.
directive
- Routing directiveorigRequest
- An initial request that the application receivedIllegalStateException
- when given directive cannot be setSipApplicationRoutingDirective getRoutingDirective() throws IllegalStateException
SipApplicationRoutingDirective
associated with
this request.SipApplicationRoutingDirective
associated with this
request.IllegalStateException
- if called on a request that is not initialSipApplicationRoutingRegion getRegion()
SipServletRequest.getSubscriberURI()
.
If this SipServletRequest is an initial request, this method returns the
region in which this servlet is invoked. The SipApplicationRoutingRegion
is only available for initial requests. For all other requests, this
method throws IllegalStateException.
IllegalStateException
- if this method is called on a request that is not initial.URI getSubscriberURI()
IllegalStateException
- if this method is called on a request that is not initial.void addAuthHeader(SipServletResponse challengeResponse, AuthInfo authInfo)
challengeResponse
- The challenge response (401/407) receieved from a
UAS/Proxy.authInfo
- The AuthInfo
object that will add the
Authentication headers to the request.void addAuthHeader(SipServletResponse challengeResponse, String username, String password)
AuthInfo
object.challengeResponse
- the challenge response (401/407) receieved from a
UAS/Proxy.username
- password
- String getId()
SipServletResponse getFinalResponse()
SipServletResponse
object representing final response.SipServletResponse getAcknowledgedResponse()
SipServletResponse
being acknowledged.IllegalStateException
- if it is called on a request which is not an ACK or PRACK
or if the servlet is acting as a proxy for the INVITE transaction.InviteBranch createInviteBranch()
InviteBranch
IllegalStateException
- if it is called on a request which is not an initial INVITE
or if the container is not acting as the UAS for the INVITE transactionboolean isRequestUriInternal()
Copyright © 1996-2015, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.