|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.faces.application.StateManager
org.apache.myfaces.trinidadinternal.application.StateManagerImpl
public class StateManagerImpl
StateManager that handles a hybrid client/server strategy: a SerializedView is stored on the server, and only a small token is stored on the client.
In addition, an optional Application view cache is supported. This view cache will, when enabled, perform special caching of all state for non-postback requests (that is, the initial state of all pages). For all pages, their SerializedView state is stored in a Map at application scope, and reused across all users. This simultaneously eliminates the expense of saving the state at all (except for the first request for any page), and significantly reduces memory usage as long as users are largely viewing initial pages only.
In addition, because the viewId is sufficient to identify the page state out of the cache, the token can be completely constant across requests and users. This makes it possible to cache the page content (which is not possible otherwise).
Since application scope objects do not support failover, a mirror of the cache is saved at session scope. The mirror is an LRU map of the last 16 application-scoped entries, but since it stores precisely the same SerializedView instances as the application scope, the additional memory requirements are minimal.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.faces.application.StateManager |
---|
javax.faces.application.StateManager.SerializedView |
Field Summary | |
---|---|
static java.lang.String |
CACHE_VIEW_ROOT_INIT_PARAM
|
static java.lang.String |
CLIENT_STATE_MAX_TOKENS_PARAM_NAME
Servlet context initialization parameter used by StateManagerImpl to decide how many tokens can be stored per user. |
static java.lang.String |
CLIENT_STATE_METHOD_ALL
Value indicating that the entire component state will be stored on the client. |
static java.lang.String |
CLIENT_STATE_METHOD_PARAM_NAME
Servlet context initialization parameter used by StateManagerImpl to decide what sort of state should be saved on the client. |
static java.lang.String |
CLIENT_STATE_METHOD_TOKEN
Value indicating that only a simple token will be stored on the client. |
static java.lang.String |
USE_APPLICATION_VIEW_CACHE_INIT_PARAM
|
Fields inherited from class javax.faces.application.StateManager |
---|
STATE_SAVING_METHOD_CLIENT, STATE_SAVING_METHOD_PARAM_NAME, STATE_SAVING_METHOD_SERVER |
Constructor Summary | |
---|---|
StateManagerImpl(javax.faces.application.StateManager delegate)
|
Method Summary | |
---|---|
protected java.lang.Object |
getComponentStateToSave(javax.faces.context.FacesContext context)
|
protected java.lang.Object |
getTreeStructureToSave(javax.faces.context.FacesContext context)
|
boolean |
isSavingStateInClient(javax.faces.context.FacesContext context)
|
protected void |
restoreComponentState(javax.faces.context.FacesContext context,
javax.faces.component.UIViewRoot viewRoot,
java.lang.String renderKitId)
|
static javax.faces.component.UIComponent |
restoreComponentTree(javax.faces.context.FacesContext context,
java.lang.Object savedState)
|
protected javax.faces.component.UIViewRoot |
restoreTreeStructure(javax.faces.context.FacesContext context,
java.lang.String viewId,
java.lang.String renderKitId)
|
javax.faces.component.UIViewRoot |
restoreView(javax.faces.context.FacesContext context,
java.lang.String viewId,
java.lang.String renderKitId)
|
static javax.faces.component.UIViewRoot |
restoreViewRoot(javax.faces.context.FacesContext context,
java.lang.Object saved)
|
static java.lang.Object |
saveComponentTree(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
|
javax.faces.application.StateManager.SerializedView |
saveSerializedView(javax.faces.context.FacesContext context)
|
static java.lang.Object |
saveViewRoot(javax.faces.context.FacesContext context,
javax.faces.component.UIViewRoot root)
Save a view root. |
void |
writeState(javax.faces.context.FacesContext context,
javax.faces.application.StateManager.SerializedView state)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String USE_APPLICATION_VIEW_CACHE_INIT_PARAM
public static final java.lang.String CACHE_VIEW_ROOT_INIT_PARAM
public static final java.lang.String CLIENT_STATE_METHOD_PARAM_NAME
public static final java.lang.String CLIENT_STATE_MAX_TOKENS_PARAM_NAME
public static final java.lang.String CLIENT_STATE_METHOD_TOKEN
public static final java.lang.String CLIENT_STATE_METHOD_ALL
Constructor Detail |
---|
public StateManagerImpl(javax.faces.application.StateManager delegate)
Method Detail |
---|
public static java.lang.Object saveComponentTree(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
public static javax.faces.component.UIComponent restoreComponentTree(javax.faces.context.FacesContext context, java.lang.Object savedState) throws java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException
public static java.lang.Object saveViewRoot(javax.faces.context.FacesContext context, javax.faces.component.UIViewRoot root)
public static javax.faces.component.UIViewRoot restoreViewRoot(javax.faces.context.FacesContext context, java.lang.Object saved) throws java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException
public javax.faces.application.StateManager.SerializedView saveSerializedView(javax.faces.context.FacesContext context)
saveSerializedView
in class javax.faces.application.StateManager
public void writeState(javax.faces.context.FacesContext context, javax.faces.application.StateManager.SerializedView state) throws java.io.IOException
writeState
in class javax.faces.application.StateManager
java.io.IOException
public javax.faces.component.UIViewRoot restoreView(javax.faces.context.FacesContext context, java.lang.String viewId, java.lang.String renderKitId)
restoreView
in class javax.faces.application.StateManager
public boolean isSavingStateInClient(javax.faces.context.FacesContext context)
isSavingStateInClient
in class javax.faces.application.StateManager
protected java.lang.Object getTreeStructureToSave(javax.faces.context.FacesContext context)
getTreeStructureToSave
in class javax.faces.application.StateManager
protected java.lang.Object getComponentStateToSave(javax.faces.context.FacesContext context)
getComponentStateToSave
in class javax.faces.application.StateManager
protected javax.faces.component.UIViewRoot restoreTreeStructure(javax.faces.context.FacesContext context, java.lang.String viewId, java.lang.String renderKitId)
restoreTreeStructure
in class javax.faces.application.StateManager
protected void restoreComponentState(javax.faces.context.FacesContext context, javax.faces.component.UIViewRoot viewRoot, java.lang.String renderKitId)
restoreComponentState
in class javax.faces.application.StateManager
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |