org.mobicents.servlet.sip.message
Class SipServletRequestImpl

java.lang.Object
  extended by org.mobicents.servlet.sip.message.SipServletMessageImpl
      extended by org.mobicents.servlet.sip.message.SipServletRequestImpl
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Cloneable, javax.servlet.ServletRequest, SipServletMessage, SipServletRequest

public class SipServletRequestImpl
extends SipServletMessageImpl
implements SipServletRequest

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.servlet.sip.SipServletMessage
SipServletMessage.HeaderForm
 
Field Summary
static java.util.Set<java.lang.String> NON_INITIAL_SIP_REQUEST_METHODS
           
static java.lang.String STALE
           
 
Fields inherited from class org.mobicents.servlet.sip.message.SipServletMessageImpl
attributes, currentApplicationName, dialog, headerForm, isMessageSent, message, method, REL100_OPTION_TAG, remoteAddr, remotePort, sessionKey, sipFactoryImpl, sipSession, transactionApplicationData, transport, userPrincipal
 
Constructor Summary
SipServletRequestImpl()
           
SipServletRequestImpl(javax.sip.message.Request request, SipFactoryImpl sipFactoryImpl, MobicentsSipSession sipSession, javax.sip.Transaction transaction, javax.sip.Dialog dialog, boolean createDialog)
           
 
Method Summary
 void addAcceptLanguage(java.util.Locale locale)
           
 void addAddressHeader(java.lang.String name, Address addr, boolean first)
           
 void addAuthHeader(SipServletResponse challengeResponse, AuthInfo authInfo)
           
 void addAuthHeader(SipServletResponse challengeResponse, java.lang.String username, java.lang.String password)
           
 void addHeader(java.lang.String name, java.lang.String value)
           
 void addInfoForRoutingBackToContainer(SipApplicationRouterInfo routerInfo, java.lang.String applicationSessionId, java.lang.String applicationName)
          Add a route header to route back to the container
 void addParameterableHeader(java.lang.String name, Parameterable param, boolean first)
           
protected  void checkMessageState()
           
protected  void checkReadOnly()
           
 void cleanUp()
           
 void cleanUpLastResponses()
           
 SipServletRequest createCancel()
           
 SipServletResponse createResponse(int statusCode)
           
 SipServletResponse createResponse(int statusCode, java.lang.String reasonPhrase)
           
 SipServletResponse createResponse(int statusCode, java.lang.String reasonPhrase, boolean validate)
           
 B2buaHelper getB2buaHelper()
           
 Address getInitialPoppedRoute()
           
 java.lang.String getInitialRemoteAddr()
          
 int getInitialRemotePort()
          
 java.lang.String getInitialTransport()
          
 javax.servlet.ServletInputStream getInputStream()
           
 SipServletResponse getLastFinalResponse()
           
 SipServletResponse getLastInformationalResponse()
           
 SipServletRequestImpl getLinkedRequest()
           
 java.util.Locale getLocale()
           
 java.util.Enumeration getLocales()
           
 java.lang.String getLocalName()
           
 int getMaxForwards()
           
 java.lang.String getParameter(java.lang.String name)
           
 java.util.Map<java.lang.String,java.lang.String> getParameterMap()
           
 java.util.Enumeration<java.lang.String> getParameterNames()
           
 java.lang.String[] getParameterValues(java.lang.String name)
           
 Address getPoppedRoute()
           
 javax.sip.header.RouteHeader getPoppedRouteHeader()
           
 Proxy getProxy()
          
 Proxy getProxy(boolean create)
          
 java.io.BufferedReader getReader()
          
 java.lang.String getRealPath(java.lang.String arg0)
           
 SipApplicationRoutingRegion getRegion()
           
 java.lang.String getRemoteHost()
           
 javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String handler)
          
 URI getRequestURI()
          
 SipApplicationRoutingDirective getRoutingDirective()
           
 RoutingState getRoutingState()
           
 java.lang.String getScheme()
           
 java.lang.String getServerName()
           
 int getServerPort()
           
 URI getSubscriberURI()
          
 boolean is1xxResponseGenerated()
           
 boolean isCommitted()
           
 boolean isFinalResponseGenerated()
           
 boolean isInitial()
          
 boolean isSystemHeader(java.lang.String headerName)
          Applications must not add, delete, or modify so-called "system" headers.
static void optimizeRouteHeaderAddressForInternalRoutingrequest(SipConnector sipConnector, javax.sip.message.Request request, MobicentsSipSession session, SipFactoryImpl sipFactoryImpl, java.lang.String transport)
           
 void pushPath(Address uri)
          
 void pushRoute(Address address)
          
 void pushRoute(SipURI uri)
           
 void readExternal(java.io.ObjectInput in)
           
 void removeAttribute(java.lang.String name)
           
 void removeHeader(java.lang.String name)
           
protected  void removeStaleAuthHeaders(javax.sip.header.WWWAuthenticateHeader responseAuthHeader)
           
 void send()
           
 void setAcceptLanguage(java.util.Locale locale)
           
 void setAddressHeader(java.lang.String name, Address addr)
           
 void setAttribute(java.lang.String name, java.lang.Object o)
           
 void setCharacterEncoding(java.lang.String enc)
           
 void setContent(java.lang.Object content, java.lang.String contentType)
           
 void setContentLanguage(java.util.Locale locale)
           
 void setContentType(java.lang.String type)
           
 void setExpires(int seconds)
           
 void setHeader(java.lang.String name, java.lang.String value)
           
 void setHeaderForm(SipServletMessage.HeaderForm form)
           
 void setLinkedRequest(SipServletRequestImpl linkedRequest)
          Add a record route header for app composition
 void setMaxForwards(int n)
           
 void setParameterableHeader(java.lang.String name, Parameterable param)
           
 void setPoppedRoute(javax.sip.header.RouteHeader routeHeader)
          Set the popped route
 void setReadOnly(boolean isReadOnly)
           
 void setRequestURI(URI uri)
           
 void setResponse(SipServletResponseImpl response)
           
 void setRoutingDirective(SipApplicationRoutingDirective directive, SipServletRequest origRequest)
           
 void setRoutingRegion(SipApplicationRoutingRegion routingRegion)
          This method allows the application to set the region that the application is in with respect to this SipSession
 void setRoutingState(RoutingState routingState)
           
 void setSubscriberURI(URI uri)
           
protected  void updateContactHeaderTransport(java.lang.String transport)
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class org.mobicents.servlet.sip.message.SipServletMessageImpl
addHeaderInternal, clone, containsRel100, createParameterable, getAcceptLanguage, getAcceptLanguages, getAddressHeader, getAddressHeaders, getApplicationSession, getApplicationSession, getAttribute, getAttributeNames, getCallId, getCharacterEncoding, getCompactName, getContent, getContentLanguage, getContentLength, getContentType, getCorrectHeaderName, getCorrectHeaderName, getCurrentApplicationName, getDialog, getExpires, getFrom, getFullHeaderName, getHeader, getHeaderForm, getHeaderNames, getHeaders, getLocalAddr, getLocalPort, getMessage, getMethod, getParameterableHeader, getParameterableHeaders, getProtocol, getRawContent, getRemoteAddr, getRemotePort, getRemoteUser, getSession, getSession, getSipSession, getSipSessionKey, getTo, getTransaction, getTransactionApplicationData, getTransport, getUserPrincipal, isAddressTypeHeader, isParameterable, isSecure, isUserInRole, removeHeaderInternal, setContentLength, setCurrentApplicationName, setHeaderInternal, setSipSession, setTransaction, setTransport, setUserPrincipal, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.servlet.sip.SipServletMessage
getAcceptLanguage, getAcceptLanguages, getAddressHeader, getAddressHeaders, getApplicationSession, getApplicationSession, getAttribute, getAttributeNames, getCallId, getCharacterEncoding, getContent, getContentLanguage, getContentLength, getContentType, getExpires, getFrom, getHeader, getHeaderForm, getHeaderNames, getHeaders, getLocalAddr, getLocalPort, getMethod, getParameterableHeader, getParameterableHeaders, getProtocol, getRawContent, getRemoteAddr, getRemotePort, getRemoteUser, getSession, getSession, getTo, getTransport, getUserPrincipal, isSecure, isUserInRole, setContentLength
 
Methods inherited from interface javax.servlet.ServletRequest
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getLocalAddr, getLocalPort, getProtocol, getRemoteAddr, getRemotePort, isSecure
 

Field Detail

STALE

public static final java.lang.String STALE
See Also:
Constant Field Values

NON_INITIAL_SIP_REQUEST_METHODS

public static final java.util.Set<java.lang.String> NON_INITIAL_SIP_REQUEST_METHODS
Constructor Detail

SipServletRequestImpl

public SipServletRequestImpl()

SipServletRequestImpl

public SipServletRequestImpl(javax.sip.message.Request request,
                             SipFactoryImpl sipFactoryImpl,
                             MobicentsSipSession sipSession,
                             javax.sip.Transaction transaction,
                             javax.sip.Dialog dialog,
                             boolean createDialog)
Method Detail

isSystemHeader

public boolean isSystemHeader(java.lang.String headerName)
Description copied from class: SipServletMessageImpl
Applications must not add, delete, or modify so-called "system" headers. These are header fields that the servlet container manages: From, To, Call-ID, CSeq, Via, Route (except through pushRoute), Record-Route. Contact is a system header field in messages other than REGISTER requests and responses, 3xx and 485 responses, and 200/OPTIONS responses. Additionally, for containers implementing the reliable provisional responses extension, RAck and RSeq are considered system headers also. This method should return true if passed name - full or compact is name of system header in context of this message. Each subclass has to implement it in the manner that it conforms to semantics of wrapping class

Specified by:
isSystemHeader in class SipServletMessageImpl
Parameters:
headerName - - either long or compact header name
Returns:

createCancel

public SipServletRequest createCancel()
Specified by:
createCancel in interface SipServletRequest

createResponse

public SipServletResponse createResponse(int statusCode)
Specified by:
createResponse in interface SipServletRequest

createResponse

public SipServletResponse createResponse(int statusCode,
                                         java.lang.String reasonPhrase)
Specified by:
createResponse in interface SipServletRequest

createResponse

public SipServletResponse createResponse(int statusCode,
                                         java.lang.String reasonPhrase,
                                         boolean validate)

getB2buaHelper

public B2buaHelper getB2buaHelper()
Specified by:
getB2buaHelper in interface SipServletRequest

getInputStream

public javax.servlet.ServletInputStream getInputStream()
                                                throws java.io.IOException
Specified by:
getInputStream in interface javax.servlet.ServletRequest
Specified by:
getInputStream in interface SipServletRequest
Throws:
java.io.IOException

getMaxForwards

public int getMaxForwards()
Specified by:
getMaxForwards in interface SipServletRequest

getPoppedRoute

public Address getPoppedRoute()
Specified by:
getPoppedRoute in interface SipServletRequest

getPoppedRouteHeader

public javax.sip.header.RouteHeader getPoppedRouteHeader()

setPoppedRoute

public void setPoppedRoute(javax.sip.header.RouteHeader routeHeader)
Set the popped route

Parameters:
routeHeader - the popped route header to set

getProxy

public Proxy getProxy()
               throws TooManyHopsException

Specified by:
getProxy in interface SipServletRequest
Throws:
TooManyHopsException

getProxy

public Proxy getProxy(boolean create)
               throws TooManyHopsException

Specified by:
getProxy in interface SipServletRequest
Throws:
TooManyHopsException

getReader

public java.io.BufferedReader getReader()
                                 throws java.io.IOException

Specified by:
getReader in interface javax.servlet.ServletRequest
Specified by:
getReader in interface SipServletRequest
Throws:
java.io.IOException

getRequestURI

public URI getRequestURI()

Specified by:
getRequestURI in interface SipServletRequest

isInitial

public boolean isInitial()

Specified by:
isInitial in interface SipServletRequest

isCommitted

public boolean isCommitted()
Specified by:
isCommitted in interface SipServletMessage

checkMessageState

protected void checkMessageState()
Specified by:
checkMessageState in class SipServletMessageImpl

pushPath

public void pushPath(Address uri)

Specified by:
pushPath in interface SipServletRequest

pushRoute

public void pushRoute(Address address)

Specified by:
pushRoute in interface SipServletRequest

pushRoute

public void pushRoute(SipURI uri)
Specified by:
pushRoute in interface SipServletRequest

setMaxForwards

public void setMaxForwards(int n)
Specified by:
setMaxForwards in interface SipServletRequest

setRequestURI

public void setRequestURI(URI uri)
Specified by:
setRequestURI in interface SipServletRequest

setRoutingDirective

public void setRoutingDirective(SipApplicationRoutingDirective directive,
                                SipServletRequest origRequest)
                         throws java.lang.IllegalStateException
Specified by:
setRoutingDirective in interface SipServletRequest
Throws:
java.lang.IllegalStateException

getLocalName

public java.lang.String getLocalName()
Specified by:
getLocalName in interface javax.servlet.ServletRequest

getLocale

public java.util.Locale getLocale()
Specified by:
getLocale in interface javax.servlet.ServletRequest

getLocales

public java.util.Enumeration getLocales()
Specified by:
getLocales in interface javax.servlet.ServletRequest

getParameter

public java.lang.String getParameter(java.lang.String name)
Specified by:
getParameter in interface javax.servlet.ServletRequest

getParameterMap

public java.util.Map<java.lang.String,java.lang.String> getParameterMap()
Specified by:
getParameterMap in interface javax.servlet.ServletRequest

getParameterNames

public java.util.Enumeration<java.lang.String> getParameterNames()
Specified by:
getParameterNames in interface javax.servlet.ServletRequest

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Specified by:
getParameterValues in interface javax.servlet.ServletRequest

getRealPath

public java.lang.String getRealPath(java.lang.String arg0)
Specified by:
getRealPath in interface javax.servlet.ServletRequest

getRemoteHost

public java.lang.String getRemoteHost()
Specified by:
getRemoteHost in interface javax.servlet.ServletRequest

getRequestDispatcher

public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String handler)

Specified by:
getRequestDispatcher in interface javax.servlet.ServletRequest

getScheme

public java.lang.String getScheme()
Specified by:
getScheme in interface javax.servlet.ServletRequest

getServerName

public java.lang.String getServerName()
Specified by:
getServerName in interface javax.servlet.ServletRequest

getServerPort

public int getServerPort()
Specified by:
getServerPort in interface javax.servlet.ServletRequest

getRoutingDirective

public SipApplicationRoutingDirective getRoutingDirective()
Specified by:
getRoutingDirective in interface SipServletRequest
Returns:
the routingDirective

optimizeRouteHeaderAddressForInternalRoutingrequest

public static void optimizeRouteHeaderAddressForInternalRoutingrequest(SipConnector sipConnector,
                                                                       javax.sip.message.Request request,
                                                                       MobicentsSipSession session,
                                                                       SipFactoryImpl sipFactoryImpl,
                                                                       java.lang.String transport)

send

public void send()
Specified by:
send in interface SipServletMessage
Specified by:
send in interface SipServletRequest
Specified by:
send in class SipServletMessageImpl

updateContactHeaderTransport

protected void updateContactHeaderTransport(java.lang.String transport)
                                     throws java.text.ParseException
Throws:
java.text.ParseException

addInfoForRoutingBackToContainer

public void addInfoForRoutingBackToContainer(SipApplicationRouterInfo routerInfo,
                                             java.lang.String applicationSessionId,
                                             java.lang.String applicationName)
                                      throws java.text.ParseException,
                                             javax.sip.SipException
Add a route header to route back to the container

Parameters:
applicationName - the application name that was chosen by the AR to route the request
Throws:
java.text.ParseException
javax.sip.SipException
java.lang.NullPointerException

setLinkedRequest

public void setLinkedRequest(SipServletRequestImpl linkedRequest)
Add a record route header for app composition

Throws:
java.text.ParseException - if anything goes wrong while creating the record route header
javax.sip.SipException
java.lang.NullPointerException - public void addAppCompositionRRHeader() throws ParseException, SipException { final Request request = (Request) super.message; final MobicentsSipSession session = getSipSession(); javax.sip.address.SipURI sipURI = JainSipUtils.createRecordRouteURI( sipFactoryImpl.getSipNetworkInterfaceManager(), request); sipURI.setParameter(MessageDispatcher.RR_PARAM_APPLICATION_NAME, session.getKey().getApplicationName()); sipURI.setLrParam(); javax.sip.address.Address recordRouteAddress = SipFactories.addressFactory.createAddress(sipURI); RecordRouteHeader recordRouteHeader = SipFactories.headerFactory.createRecordRouteHeader(recordRouteAddress); request.addFirst(recordRouteHeader); }

getLinkedRequest

public SipServletRequestImpl getLinkedRequest()

getRoutingState

public RoutingState getRoutingState()
Returns:
the routingState

setRoutingState

public void setRoutingState(RoutingState routingState)
                     throws java.lang.IllegalStateException
Parameters:
routingState - the routingState to set
Throws:
java.lang.IllegalStateException

addAuthHeader

public void addAuthHeader(SipServletResponse challengeResponse,
                          AuthInfo authInfo)
Specified by:
addAuthHeader in interface SipServletRequest

addAuthHeader

public void addAuthHeader(SipServletResponse challengeResponse,
                          java.lang.String username,
                          java.lang.String password)
Specified by:
addAuthHeader in interface SipServletRequest

removeStaleAuthHeaders

protected void removeStaleAuthHeaders(javax.sip.header.WWWAuthenticateHeader responseAuthHeader)

getLastFinalResponse

public SipServletResponse getLastFinalResponse()
Returns:
the finalResponse

setResponse

public void setResponse(SipServletResponseImpl response)
Parameters:
finalResponse - the finalResponse to set

getInitialPoppedRoute

public Address getInitialPoppedRoute()
Specified by:
getInitialPoppedRoute in interface SipServletRequest

getRegion

public SipApplicationRoutingRegion getRegion()
Specified by:
getRegion in interface SipServletRequest

setRoutingRegion

public void setRoutingRegion(SipApplicationRoutingRegion routingRegion)
This method allows the application to set the region that the application is in with respect to this SipSession

Parameters:
routingRegion - the region that the application is in

getSubscriberURI

public URI getSubscriberURI()

Specified by:
getSubscriberURI in interface SipServletRequest

setSubscriberURI

public void setSubscriberURI(URI uri)

is1xxResponseGenerated

public boolean is1xxResponseGenerated()
Returns:
the is1xxResponseGenerated

isFinalResponseGenerated

public boolean isFinalResponseGenerated()
Returns:
the isFinalResponseGenerated

getLastInformationalResponse

public SipServletResponse getLastInformationalResponse()
Returns:
the lastInformationalResponse

setReadOnly

public void setReadOnly(boolean isReadOnly)

checkReadOnly

protected void checkReadOnly()

addAcceptLanguage

public void addAcceptLanguage(java.util.Locale locale)
Specified by:
addAcceptLanguage in interface SipServletMessage
Overrides:
addAcceptLanguage in class SipServletMessageImpl

addAddressHeader

public void addAddressHeader(java.lang.String name,
                             Address addr,
                             boolean first)
                      throws java.lang.IllegalArgumentException
Specified by:
addAddressHeader in interface SipServletMessage
Overrides:
addAddressHeader in class SipServletMessageImpl
Throws:
java.lang.IllegalArgumentException

addHeader

public void addHeader(java.lang.String name,
                      java.lang.String value)
Specified by:
addHeader in interface SipServletMessage
Overrides:
addHeader in class SipServletMessageImpl

addParameterableHeader

public void addParameterableHeader(java.lang.String name,
                                   Parameterable param,
                                   boolean first)
Specified by:
addParameterableHeader in interface SipServletMessage
Overrides:
addParameterableHeader in class SipServletMessageImpl

removeAttribute

public void removeAttribute(java.lang.String name)
Specified by:
removeAttribute in interface javax.servlet.ServletRequest
Specified by:
removeAttribute in interface SipServletMessage
Overrides:
removeAttribute in class SipServletMessageImpl

removeHeader

public void removeHeader(java.lang.String name)
Specified by:
removeHeader in interface SipServletMessage
Overrides:
removeHeader in class SipServletMessageImpl

setAcceptLanguage

public void setAcceptLanguage(java.util.Locale locale)
Specified by:
setAcceptLanguage in interface SipServletMessage
Overrides:
setAcceptLanguage in class SipServletMessageImpl

setAddressHeader

public void setAddressHeader(java.lang.String name,
                             Address addr)
Specified by:
setAddressHeader in interface SipServletMessage
Overrides:
setAddressHeader in class SipServletMessageImpl

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object o)
Specified by:
setAttribute in interface javax.servlet.ServletRequest
Specified by:
setAttribute in interface SipServletMessage
Overrides:
setAttribute in class SipServletMessageImpl

setCharacterEncoding

public void setCharacterEncoding(java.lang.String enc)
                          throws java.io.UnsupportedEncodingException
Specified by:
setCharacterEncoding in interface javax.servlet.ServletRequest
Specified by:
setCharacterEncoding in interface SipServletMessage
Overrides:
setCharacterEncoding in class SipServletMessageImpl
Throws:
java.io.UnsupportedEncodingException

setContent

public void setContent(java.lang.Object content,
                       java.lang.String contentType)
                throws java.io.UnsupportedEncodingException
Specified by:
setContent in interface SipServletMessage
Overrides:
setContent in class SipServletMessageImpl
Throws:
java.io.UnsupportedEncodingException

setContentLanguage

public void setContentLanguage(java.util.Locale locale)
Specified by:
setContentLanguage in interface SipServletMessage
Overrides:
setContentLanguage in class SipServletMessageImpl

setContentType

public void setContentType(java.lang.String type)
Specified by:
setContentType in interface SipServletMessage
Overrides:
setContentType in class SipServletMessageImpl

setExpires

public void setExpires(int seconds)
Specified by:
setExpires in interface SipServletMessage
Overrides:
setExpires in class SipServletMessageImpl

setHeader

public void setHeader(java.lang.String name,
                      java.lang.String value)
Specified by:
setHeader in interface SipServletMessage
Overrides:
setHeader in class SipServletMessageImpl

setHeaderForm

public void setHeaderForm(SipServletMessage.HeaderForm form)
Specified by:
setHeaderForm in interface SipServletMessage
Overrides:
setHeaderForm in class SipServletMessageImpl

setParameterableHeader

public void setParameterableHeader(java.lang.String name,
                                   Parameterable param)
Specified by:
setParameterableHeader in interface SipServletMessage
Overrides:
setParameterableHeader in class SipServletMessageImpl

getInitialRemoteAddr

public java.lang.String getInitialRemoteAddr()

Specified by:
getInitialRemoteAddr in interface SipServletMessage
Overrides:
getInitialRemoteAddr in class SipServletMessageImpl

getInitialRemotePort

public int getInitialRemotePort()

Specified by:
getInitialRemotePort in interface SipServletMessage
Overrides:
getInitialRemotePort in class SipServletMessageImpl

getInitialTransport

public java.lang.String getInitialTransport()

Specified by:
getInitialTransport in interface SipServletMessage
Overrides:
getInitialTransport in class SipServletMessageImpl

cleanUp

public void cleanUp()
Specified by:
cleanUp in class SipServletMessageImpl

cleanUpLastResponses

public void cleanUpLastResponses()

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Overrides:
readExternal in class SipServletMessageImpl
Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Overrides:
writeExternal in class SipServletMessageImpl
Throws:
java.io.IOException


Copyright © 2010. All Rights Reserved.