Class StateCache<K,V>

java.lang.Object
org.apache.myfaces.application.viewstate.StateCache<K,V>

public abstract class StateCache<K,V> extends Object
This class provides an interface to separate the state caching operations (saving/restoring) from the renderkit specific stuff that HtmlResponseStateManager should do.
Author:
Leonardo Uribe
  • Constructor Details

    • StateCache

      public StateCache()
  • Method Details

    • saveSerializedView

      public abstract K saveSerializedView(FacesContext facesContext, V serializedView)
      Put the state on the cache, to can be restored later.
      Parameters:
      facesContext -
      serializedView -
    • restoreSerializedView

      public abstract V restoreSerializedView(FacesContext facesContext, String viewId, K viewState)
      Get the state from the cache is server side state saving is used, or decode it from the passed viewState param if client side is used.
      Parameters:
      facesContext -
      viewId - The viewId of the view to be restored
      viewState - A token usually retrieved from a call to ResponseStateManager.getState that will be used to identify or restore the state.
      Returns:
    • encodeSerializedState

      public abstract K encodeSerializedState(FacesContext facesContext, Object serializedView)
      Calculate the token to be used if server side state saving, or encode the view and return the viewState that can be used by the underlying ResponseStateManager to write the state.
      Parameters:
      facesContext -
      serializedView - The state that will be used to derive the token returned.
      Returns:
      A token (usually encoded on jakarta.faces.ViewState input hidden field) that will be passed to ResponseStateManager.writeState or ResponseStateManager.getViewState to be output to the client.
    • isWriteStateAfterRenderViewRequired

      public abstract boolean isWriteStateAfterRenderViewRequired(FacesContext facesContext)
      Indicates if the call to ResponseStateManager.writeState should be done after the view is fully rendered. Usually this is required for client side state saving, but it is not for server side state saving, because ResponseStateManager.writeState could render a just a marker and then StateManager.saveState could be called, preventing use an additional buffer.
      Parameters:
      facesContext -
      Returns:
    • createCryptographicallyStrongTokenFromSession

      public abstract String createCryptographicallyStrongTokenFromSession(FacesContext context)
      Parameters:
      context -
      Returns:
      Since:
      2.2
    • getStateTokenProcessor

      public abstract StateTokenProcessor getStateTokenProcessor(FacesContext context)