public interface PxtSessionDelegate
Similiar operations can be found in RequestContext. Even though a similiar API already exists in RequestContext, this API is provided to server those client who need only these operations and not the full API of RequestContext. Therefore, it is reccomended that you use PxtSessionDelegate instead of RequestContext if this API provides all of the operations that you need.
You obtain instances of PxtSessionDelegate from PxtSessionDelegateFactory. Below is an
example of how you might retrieve a PxtSessionDelegate:
HttpServletRequest request = // Get the current request... PxtSessionDelegateFactory factory = PxtSessionDelegateFactory.getInstance(); PxtSessionDelegate pxtDelegate = factory.newPxtSessionDelegate(request);
PxtSessionDelegateFactory
,
RequestContext
Modifier and Type | Method and Description |
---|---|
WebSession |
getPxtSession(javax.servlet.http.HttpServletRequest request)
Retrieve the pxt session.
|
WebSession |
getPxtSessionIfExists(javax.servlet.http.HttpServletRequest request)
Retrieve the pxt session if there is a cookie identifying it or if it was
already bound.
|
java.lang.Long |
getWebUserId(javax.servlet.http.HttpServletRequest request)
Returns the
webUserId property of the pxt session bound to the specified
request. |
void |
invalidatePxtSession(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Invalidates the pxt session for the given request.
|
boolean |
isPxtSessionExpired(javax.servlet.http.HttpServletRequest request)
Return
true if the pxt session for the current request has expired. |
boolean |
isPxtSessionKeyValid(javax.servlet.http.HttpServletRequest request)
Validates the pxt session ID that is stored in the pxt cookie with a secret key in
the pxt session.
|
void |
refreshPxtSession(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Refreshes the pxt session, effectively reseting the timeout of the session.
|
void |
updateWebUserId(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Long id)
Sets the
webUserId property of the pxt session bound to the specified
request. |
java.lang.Long getWebUserId(javax.servlet.http.HttpServletRequest request)
webUserId
property of the pxt session bound to the specified
request.request
- The current requestwebUserId
property of the pxt session.WebSession getPxtSession(javax.servlet.http.HttpServletRequest request)
session
.request
- The current requestWebSession getPxtSessionIfExists(javax.servlet.http.HttpServletRequest request)
session
.request
- The current requestvoid updateWebUserId(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Long id)
webUserId
property of the pxt session bound to the specified
request. Note that this operation triggers a session refresh.request
- The current requestresponse
- The current responseid
- The ID to be assigned to the webUserId
property.refreshPxtSession(HttpServletRequest, HttpServletResponse)
boolean isPxtSessionExpired(javax.servlet.http.HttpServletRequest request)
true
if the pxt session for the current request has expired.request
- The current requesttrue
if the pxt session for the current request has expired,
false
otherwiseboolean isPxtSessionKeyValid(javax.servlet.http.HttpServletRequest request)
true
if the encoded session ID matches the
secret key.request
- The current requesttrue
if the encoded session ID matches the secret key,
false
otherwise.void refreshPxtSession(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
expires
property of the session to an appropriate value.
request
- The current requestresponse
- The current responsevoid invalidatePxtSession(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
request
- The current requestresponse
- The current response