Save This Page
Home » trinidad-1.2.8-src-all » org.apache.myfaces.trinidadinternal » application » [javadoc | source]
org.apache.myfaces.trinidadinternal.application
public class: StateManagerImpl [javadoc | source]
java.lang.Object
   javax.faces.application.StateManagerWrapper
      org.apache.myfaces.trinidadinternal.application.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.

Application View cache

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.

Field Summary
public static final  String USE_APPLICATION_VIEW_CACHE_INIT_PARAM     
public static final  String CACHE_VIEW_ROOT_INIT_PARAM     
public static final  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. Valid values are "token" and "all"; the default is "token". 
public static final  String CLIENT_STATE_MAX_TOKENS_PARAM_NAME    Servlet context initialization parameter used by StateManagerImpl to decide how many tokens can be stored per user. The default is 15. 
public static final  String CLIENT_STATE_METHOD_TOKEN    Value indicating that only a simple token will be stored on the client. 
public static final  String CLIENT_STATE_METHOD_ALL    Value indicating that the entire component state will be stored on the client. 
Constructor:
 public StateManagerImpl(StateManager delegate) 
Method from org.apache.myfaces.trinidadinternal.application.StateManagerImpl Summary:
clearReuseRequestTokenForResponse,   getComponentStateToSave,   getStateToken,   getTreeStructureToSave,   getWrapped,   isSavingStateInClient,   pinStateToRequest,   restoreComponentState,   restoreComponentTree,   restoreTreeStructure,   restoreView,   restoreViewRoot,   reuseRequestTokenForResponse,   saveComponentTree,   saveSerializedView,   saveView,   saveViewRoot,   writeState
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.myfaces.trinidadinternal.application.StateManagerImpl Detail:
 public static  void clearReuseRequestTokenForResponse(ExternalContext ec) 
    Clears the flag indicating that the old request token should be used for the response.
 protected Object getComponentStateToSave(FacesContext context) 
 public static String getStateToken(FacesContext context) 
 protected Object getTreeStructureToSave(FacesContext context) 
 protected StateManager getWrapped() 
 public boolean isSavingStateInClient(FacesContext context) 
 public static  void pinStateToRequest(FacesContext context,
    String stateToken) 
    Requests that an old state token be "pinned" to the state of the current request. This means that the view state corresponding to the token will not be released before the state for this request is released.
 protected  void restoreComponentState(FacesContext context,
    UIViewRoot viewRoot,
    String renderKitId) 
 public static UIComponent restoreComponentTree(FacesContext context,
    Object savedState) throws ClassNotFoundException, IllegalAccessException, InstantiationException 
    Take an object created by saveComponentTree() and instantiate it as a UIComponent.
 protected UIViewRoot restoreTreeStructure(FacesContext context,
    String viewId,
    String renderKitId) 
 public UIViewRoot restoreView(FacesContext context,
    String viewId,
    String renderKitId) 
 public static UIViewRoot restoreViewRoot(FacesContext context,
    Object saved) throws ClassNotFoundException, IllegalAccessException, InstantiationException 
 public static  void reuseRequestTokenForResponse(ExternalContext ec) 
    Mark the the incoming request token should be used for the response
 public static Object saveComponentTree(FacesContext context,
    UIComponent component) 
    Save a component tree as an Object.
 public SerializedView saveSerializedView(FacesContext context) 
 public Object saveView(FacesContext context) 
 public static Object saveViewRoot(FacesContext context,
    UIViewRoot root) 
    Save a view root. Doesn't return a SerializedView because SerializedView is a non-static inner class, and this needs to be a static method.
 public  void writeState(FacesContext context,
    SerializedView state) throws IOException