public interface SipSessionsUtil
This class can be accessed through the ServletContext
parameter named javax.servlet.sip.SipSessionsUtil or it can be injected
using the @Resource annotation.
| Modifier and Type | Method and Description |
|---|---|
SipApplicationSession |
getApplicationSessionById(String applicationSessionId)
Returns the SipApplicationSession for a given applicationSessionId.
|
SipApplicationSession |
getApplicationSessionByKey(String applicationSessionKey,
boolean create)
Returns the SipApplicationSession for a given session
applicationSessionKey. |
SipSession |
getCorrespondingSipSession(SipSession session,
String headerName)
Returns related SipSession.
|
SipApplicationSession |
getCurrentApplicationSession()
Returns the application session on the current thread's context.
|
<T> T |
getManagedBean(Class<T> type,
Annotation... qualifiers)
Returns the CDI bean of the specified type and qualifiers in the scope
of the application session of current thread.
|
Set<String> |
getSipApplicationSessionIds()
Return a Set of all Ids of the
SipApplicationSession
objects that belong to the application from where this method is invoked. |
Set<String> |
getSipApplicationSessionIds(String indexKey)
Return an Set of Ids of the
SipApplicationSession
objects on which the specified index key was previously added using
SipApplicationSession.addIndexKey method. |
SipApplicationSession getApplicationSessionById(String applicationSessionId)
applicationSessionId - the SipApplicationSession's idNullPointerException - if the applicationSessionId is null.SipApplicationSession.getId()SipApplicationSession getApplicationSessionByKey(String applicationSessionKey, boolean create)
applicationSessionKey.
The applicationSessionKey String is the same as that supplied to
SipFactory#createApplicationSessionByKey. The method shall return the
Application Session only if the queried application session belongs to the
application from where this method is invoked.
The method returns null in case the container does not
find the SipApplicationSession instance matching the applicationSessionKey.applicationSessionKey - session applicationSessionKey of the SipApplicationSessioncreate - controls whether new session should be created upon lookup
failurecreate is set to false. If create
is true, create a new SipApplicationSession with the
given applicationSessionKeyNullPointerException - if the applicationSessionKey is null.SipFactory.createApplicationSessionByKey(String)SipSession getCorrespondingSipSession(SipSession session, String headerName)
@Resource
SipSessionsUtil sipSessionsUtil;
protected void doInvite(SipServletRequest req) {
SipSession joining = req.getSession(true);
SipSession beingJoined = sipSessionsUtil.getCorrespondingSipSession(
joining,"Join");
[...]
}
session - one of the two related SIP sessions. For example, it can
be the joining session or the replacing session.headerName - the header name through which the association is made.
For example, for RFC 3911, it is Join,
for RFC 3891, it is Replacesnull.Set<String> getSipApplicationSessionIds(String indexKey)
SipApplicationSession
objects on which the specified index key was previously added using
SipApplicationSession.addIndexKey method.
Only the Ids of the SipApplicationSession objects belongs to
the application from where this method is invoked will be returned.indexKey - A string that act as the index key for retrieving the
Id of the SipApplicationSessionSet oof the Ids of the SipApplicationSession objects
If there is no SipApplicationSession with the specified
index key can be found, an empty Set will be returned.Set<String> getSipApplicationSessionIds()
SipApplicationSession
objects that belong to the application from where this method is invoked.Set of the Ids of the SipApplicationSession objects.SipApplicationSession getCurrentApplicationSession()
SipServletMessage that triggered servlet invocation.
When executed from a running task submitted as specified in chapter 18.3,
this method will return the application session in the context of the
task.<T> T getManagedBean(Class<T> type, Annotation... qualifiers)
SipApplicationSessionScoped will be returned. If no qualifiers are given default
qualifier is assumed.T - type of the bean.type - Class representing the type of managed bean.qualifiers - CDI qualifiers of the bean.IllegalArgumentException - if the type is not a valid bean type or
if the annotations given are not qualifiers or
if the same qualifier is given multiple timesgetCurrentApplicationSession()Copyright © 1996-2015, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.