BEA Systems, Inc.

BEA WebLogic SIP Server 3.1 API Reference


com.bea.wcp.util
Class Sessions

java.lang.Object
  extended bycom.bea.wcp.util.Sessions

public final class Sessions
extends java.lang.Object

A utility class for supporting converged applications having HTTP and SIP Sessions. An instance of this class is available as the ServletContext attribute "com.bea.wcp.util.Sessions" for converged applications.

Copyright © 2006 BEA Systems, Inc. All Rights Reserved.

Constructor Summary
Sessions(ServletContext servletContext)
           
 
Method Summary
 HttpSession createHttpSession()
          This method creates a new HttpSession.
 SipApplicationSession getApplicationSession(HttpSession httpSession)
          Returns the SipApplicationSession if a parent-child relationship exists.
 SipApplicationSession getApplicationSession(java.lang.String applicationSessionId)
          Returns the SipApplicationSession for a given applicationSessionId.
 java.util.Iterator getApplicationSessionsByCallId(java.lang.String callId)
          Returns an Iterator over all SipApplicationSessions associated with the given callId.
 java.lang.String getEncodedURL(java.lang.String url, HttpSession httpSession)
          This method encodes the HTTP URL with the jsessionid.
 java.lang.String getEncodedURL(java.lang.String relativePath, java.lang.String scheme, HttpSession httpSession)
          Converts the given relative path to an absolute URL by prepending the contextPath for the current ServletContext, the given scheme ("http" or "https"), and the host:port, and then encoding the resulting URL with the jsessionid.
 void removeApplicationSession(HttpSession httpSession)
          This method removes the specified SipApplicationSession as the parent of the given HttpSession, if it was previously designated as the parent.
 void setApplicationSession(HttpSession httpSession, SipApplicationSession sipApplicationSession)
          This method sets SipApplicationSession as the parent of the specified HttpSession.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sessions

public Sessions(ServletContext servletContext)
Method Detail

createHttpSession

public HttpSession createHttpSession()
This method creates a new HttpSession. SIP applications can then modify the session state for the newly-created HttpSession and invoke setApplicationSession to create a parent-child relationship for later use.

Returns:
new HttpSession
See Also:
setApplicationSession(javax.servlet.http.HttpSession, javax.servlet.sip.SipApplicationSession), removeApplicationSession(javax.servlet.http.HttpSession)

getApplicationSession

public SipApplicationSession getApplicationSession(HttpSession httpSession)
Returns the SipApplicationSession if a parent-child relationship exists.

Parameters:
httpSession -
Returns:
SipApplicationSession
See Also:
setApplicationSession(javax.servlet.http.HttpSession, javax.servlet.sip.SipApplicationSession), removeApplicationSession(javax.servlet.http.HttpSession)

getApplicationSession

public SipApplicationSession getApplicationSession(java.lang.String applicationSessionId)
Returns the SipApplicationSession for a given applicationSessionId. The applicationSessionId String is the same as that obtained through SipApplicationSession.getId().

Parameters:
applicationSessionId - the SipApplicationSession's id
Returns:
SipApplicationSession
See Also:
SipApplicationSession.getId()

getApplicationSessionsByCallId

public java.util.Iterator getApplicationSessionsByCallId(java.lang.String callId)
Returns an Iterator over all SipApplicationSessions associated with the given callId. There can be more than one SipApplicationSession with application composition. The callId string is the same as that obtained through the SipServletRequest.getCallId() method.

Parameters:
callId - the Call-ID String
Returns:
Iterator over all SipApplicationSessions
See Also:
SipServletMessage.getCallId()

getEncodedURL

public java.lang.String getEncodedURL(java.lang.String url,
                                      HttpSession httpSession)
This method encodes the HTTP URL with the jsessionid. ";jsessionid=http-session-id|primary|secondary". The URL parameter should be an absolute URL. For example, http://server:7001/mywebapp/foo.jsp. Where "/mywebapp" is the context path of the the current ServletContext, because that is where the httpSession belongs to.

Parameters:
url - the HTTP url String to be encoded
httpSession - the session created using createHttpSession()
Returns:
encoded URL with jsessionid
See Also:
createHttpSession()

getEncodedURL

public java.lang.String getEncodedURL(java.lang.String relativePath,
                                      java.lang.String scheme,
                                      HttpSession httpSession)
Converts the given relative path to an absolute URL by prepending the contextPath for the current ServletContext, the given scheme ("http" or "https"), and the host:port, and then encoding the resulting URL with the jsessionid.

For example, this method converts:

   from: "/foo.jsp"
   to: "http://server:8888/mywebapp/foo.jsp;jsessionid=http-session-id|primary|secondary"
 
Where,
   "/mywebapp" is the contextPath for the current ServletContext
   server is the FrontendHost defined in ClusterMBean/ServerMBean.
     If missing, it defaults to the ListenAddress of the current server.
   port is  the FrontendHTTPPort/FrontendHTTPSPort (depending on
     the scheme) as defined in the ClusterMBean/ServerMBean. If missing,
     it defaults to the publicAddress of the SSL NetworkChannel
 

Parameters:
relativePath - relative to the current webapp
scheme - the scheme ("http" or "https")
httpSession - the session created using createHttpSession()
Returns:
encoded URL with jsessionid
See Also:
createHttpSession()

removeApplicationSession

public void removeApplicationSession(HttpSession httpSession)
This method removes the specified SipApplicationSession as the parent of the given HttpSession, if it was previously designated as the parent.

Parameters:
httpSession - HttpSession
See Also:
setApplicationSession(javax.servlet.http.HttpSession, javax.servlet.sip.SipApplicationSession)

setApplicationSession

public void setApplicationSession(HttpSession httpSession,
                                  SipApplicationSession sipApplicationSession)
This method sets SipApplicationSession as the parent of the specified HttpSession. The effect is that for any subsequent getSessions() method invocation on SipApplicationSession, this HttpSession is returned in the Iterator. The callId string is the same as that obtained from SipServletRequest.getCallId().

Parameters:
httpSession - HttpSession
sipApplicationSession - SipApplicationSession
Throws:
java.lang.IllegalArgumentException - if parent has been set already
See Also:
SipServletMessage.getCallId(), removeApplicationSession(javax.servlet.http.HttpSession)

Documentation is available at
http://e-docs.bea.com/wlcp/wlss31/
Copyright 2007 BEA Systems Inc.