Class ClientSideStateHelper


  • public class ClientSideStateHelper
    extends StateHelper

    This StateHelper provides the functionality associated with client-side state saving.

    • Constructor Detail

      • ClientSideStateHelper

        public ClientSideStateHelper()
        Construct a new ClientSideStateHelper instance.
    • Method Detail

      • doGetState

        protected Object doGetState​(FacesContext ctx,
                                    String stateString)
        Rebuilds the view state from the Base64 included String included with the request.
        Parameters:
        stateString - the Base64 encoded view state
        Returns:
        the view state reconstructed from stateString
      • doWriteState

        protected void doWriteState​(FacesContext facesContext,
                                    Object state,
                                    Writer writer)
                             throws IOException
        Serializes and Base64 encodes the provided state to the provided writer/
        Parameters:
        facesContext - the Faces context.
        state - view state
        writer - the Writer to write the content to
        Throws:
        IOException - if an error occurs writing the state to the client
      • hasStateExpired

        protected boolean hasStateExpired​(long stateTime)

        If the WebConfiguration.WebContextInitParameter.ClientStateTimeout init parameter is set, calculate the elapsed time between the time the client state was written and the time this method was invoked during restore. If the client state has expired, return true. If the client state hasn't expired, or the init parameter wasn't set, return false.

        Parameters:
        stateTime - the time in milliseconds that the state was written to the client
        Returns:
        false if the client state hasn't timed out, otherwise return true
      • init

        protected void init()

        Initialze the various configuration options for client-side sate saving.