public interface ItsNatServletContext extends ItsNatUserData
javax.servlet.ServletContext
.
There is only one instance of this interface per web application.
ItsNatServlet.getItsNatServletContext()
,
ItsNatServletConfig.getItsNatServletContext()
,
ItsNatSession.getItsNatServletContext()
Modifier and Type | Method and Description |
---|---|
ItsNatVariableResolver |
createItsNatVariableResolver()
Creates a variable resolver bound to this context.
|
void |
enumerateSessions(ItsNatSessionCallback callback)
Enumerates all ItsNat sessions associated to this context.
|
ItsNat |
getItsNat()
Returns the ItsNat "root" object used to create this object.
|
int |
getMaxOpenDocumentsBySession()
Returns the max number of open documents in a user web session (documents saving state on the server).
|
javax.servlet.ServletContext |
getServletContext()
Returns the standard servlet context wrapped.
|
boolean |
isSessionExplicitSerialize()
Defines whether ItsNat explicitly serializes user sessions and saves serialized
data to the native sessions as attributes when any web request ends
and deserializing in the beginning of any web request.
|
boolean |
isSessionReplicationCapable()
Controls whether the ItsNat application is ready for automatic session replication of the servlet container.
|
boolean |
isSessionSerializeCompressed()
Defines whether the serialized data of the ItsNat session is compressed when the session
is serialized.
|
void |
setMaxOpenDocumentsBySession(int value)
Sets the max number of open documents in a user web session (documents saving state on the server).
|
void |
setSessionExplicitSerialize(boolean value)
Configures ItsNat to explicitly serialize user sessions and save serialized
data to the native sessions as attributes when any web request ends
and deserializing in the beginning of any web request.
|
void |
setSessionReplicationCapable(boolean value)
Sets whether the ItsNat application is ready for automatic session replication by the servlet container.
|
void |
setSessionSerializeCompressed(boolean value)
Sets whether the serialized data of the ItsNat session is compressed when the session
is serialized.
|
containsUserValueName, getUserValue, getUserValueNames, removeUserValue, setUserValue
javax.servlet.ServletContext getServletContext()
ItsNat getItsNat()
int getMaxOpenDocumentsBySession()
When this number is surpassed, older documents (documents not accesed for a long time ago) are invalidated/removed from the server.
A negative number means no limit.
Documents open through iframe, object or embed elements are included in this number, so the max number of open documents must be greater than the number of child documents of any page +1 (the container page). A number slightly greater is preferred (sometimes MSIE needs two requests to load the content of an iframe/object/page, that is, the page is loaded twice).
This feature is very useful to limit the server memory used by web bots (crawlers) unsupported browsers and browsers with JavaScript disabled traversing pages/documents with state (events enabled).
This feature only affects to documents not to fragments.
setMaxOpenDocumentsBySession(int)
void setMaxOpenDocumentsBySession(int value)
value
- the new max number of open documents.getMaxOpenDocumentsBySession()
boolean isSessionReplicationCapable()
When this method returns true, the ItsNat session (ItsNatHttpSession
) is registered as an attribute
in the native session calling HttpSession.setAttribute(String,Object)
and the ItsNat session is ever obtained calling HttpSession.getAttribute(String)
.
The method HttpSession.setAttribute(String,Object)
is ever called when any event processing finishes.
In an automatic session replication environment like Google App Engine (GAE), GAE automatically serializes the ItsNat session per web request, in theory GAE automatically manages concurrency between nodes and only processes one web request each time in every session.
If session replication is set to true, the ItsNat session id as returned
by ItsNatSession.getId()
is the SHA-1 value of the native session id
returned by HttpSession.getId()
, this ensures the ItsNat session id
is the same between nodes. This non-reversible ItsNat session id (SHA-1 is a one-way algorithm)
is interesting because in remote/view control ItsNat session ids can be
public, only ItsNat session ids are recognized because publishing the native id
is not a good idea because it grants full control to other users of the monitored session outside ItsNat control.
If the servlet environment is one only node (one servlet container instance) or is not doing session replication, and session replication capable is set to true, there is no appreciable difference in performance and behaviour.
Anyway if this method returns true the servlet container can serialize
the session content, this implies any user defined class bound to the session
usually through ItsNat documents, must implement java.io.Serializable
.
If the servlet environment actually does session replication, like GAE, some ItsNat features may not work.
If session replication capable feature is set to false the method
HttpSession.setAttribute(String,Object)
is not used to store the session, hence no java.io.Serializable
requirement applies to user code.
Use this mode when running your web application in a single node or
multiple nodes configured to use sticky sessions.
setSessionReplicationCapable(boolean)
void setSessionReplicationCapable(boolean value)
value
- the new mode.isSessionReplicationCapable()
boolean isSessionSerializeCompressed()
This feature is useful to reduce the amount of transported data between nodes in a cloud environment with session replication.
This configuration option set to true only has sense if session replication is enabled and when the servlet container serializes sessions.
setSessionSerializeCompressed(boolean)
,
isSessionReplicationCapable()
void setSessionSerializeCompressed(boolean value)
value
- the new mode.isSessionSerializeCompressed()
boolean isSessionExplicitSerialize()
This feature is useful to simulate how cloud environments with session replication works and to avoid serialization time limits imposed by the cloud (for instance Google App Engine).
This configuration option set to true only does something if session replication is enabled.
setSessionExplicitSerialize(boolean)
,
isSessionReplicationCapable()
void setSessionExplicitSerialize(boolean value)
value
- the new mode.isSessionExplicitSerialize()
void enumerateSessions(ItsNatSessionCallback callback)
The specified callback
is called per each session.
callback
- the callback object to call per each session.ItsNatVariableResolver createItsNatVariableResolver()
Copyright © 2007 Innowhere Software Services S.L. All Rights Reserved.