Class StateHelper
- Direct Known Subclasses:
ClientSideStateHelper,ServerSideStateHelper
public abstract class StateHelper extends Object
StateHelper implementations.-
Field Summary
Fields Modifier and Type Field Description protected booleancompressViewStateFlag indicating whether or not view state should be compressed to reduce the memory/bandwidth footprint.protected char[]fieldEndThis will be used the by the differentStateHelperimplementations when writing the end of the state or viewId field.protected char[]fieldMiddleThis will be used by the differentStateHelperimplementations when writing the middle of the state or viewId fields.protected SerializationProviderserialProviderFactory for serialization streams.protected char[]stateFieldStartThis will be used the by the differentStateHelperimplementations when writing the start of the state field.protected WebConfigurationwebConfigAccess to the context init parameters that configure this application. -
Constructor Summary
Constructors Constructor Description StateHelper()Constructs a newStateHelperinstance. -
Method Summary
Modifier and Type Method Description static voidcreateAndStoreCryptographicallyStrongTokenInSession(jakarta.servlet.http.HttpSession session)StringgetCryptographicallyStrongTokenFromSession(FacesContext context)abstract ObjectgetState(FacesContext ctx, String viewId)protected static StringgetStateParamValue(FacesContext context)Get our view state from this requestabstract booleanisStateless(FacesContext ctx, String viewId)protected voidwriteClientWindowField(FacesContext context, ResponseWriter writer)Write the client window state field.protected voidwriteRenderKitIdField(FacesContext context, ResponseWriter writer)If a customRenderKitis used, write out the ID of theRenderKitout as a hidden field.abstract voidwriteState(FacesContext ctx, Object state, StringBuilder stateCapture)Functionally similar to ResponseStateManager#writeState(FacesContext, Object) with an option to write the state directly to the providedStringBuilderwithout sending any markup to the client.
-
Field Details
-
serialProvider
Factory for serialization streams. These are pluggable via the WebConfiguration.WebContextInitParameter#SerializationProviderClass.
-
webConfig
Access to the context init parameters that configure this application.
-
compressViewState
protected boolean compressViewStateFlag indicating whether or not view state should be compressed to reduce the memory/bandwidth footprint. This option is common to both types of state saving.
-
stateFieldStart
protected char[] stateFieldStartThis will be used the by the differentStateHelperimplementations when writing the start of the state field. -
fieldMiddle
protected char[] fieldMiddleThis will be used by the differentStateHelperimplementations when writing the middle of the state or viewId fields. -
fieldEnd
protected char[] fieldEndThis will be used the by the differentStateHelperimplementations when writing the end of the state or viewId field. This value of this field is determined by the value of theWebConfiguration.BooleanWebContextInitParameter.AutoCompleteOffOnViewState
-
-
Constructor Details
-
StateHelper
public StateHelper()Constructs a newStateHelperinstance.
-
-
Method Details
-
createAndStoreCryptographicallyStrongTokenInSession
public static void createAndStoreCryptographicallyStrongTokenInSession(jakarta.servlet.http.HttpSession session) -
getCryptographicallyStrongTokenFromSession
-
writeState
public abstract void writeState(FacesContext ctx, Object state, StringBuilder stateCapture) throws IOExceptionFunctionally similar to ResponseStateManager#writeState(FacesContext, Object) with an option to write the state directly to the provided
StringBuilderwithout sending any markup to the client. -
getState
-
isStateless
-
getStateParamValue
Get our view state from this request
- Parameters:
context- theFacesContextfor the current request- Returns:
- the view state from this request
-
writeRenderKitIdField
protected void writeRenderKitIdField(FacesContext context, ResponseWriter writer) throws IOExceptionIf a custom
RenderKitis used, write out the ID of theRenderKitout as a hidden field. This will be used when restoring the view state.- Parameters:
context- theFacesContextfor the current requestwriter- theResponseWriterto write to- Throws:
IOException- if an error occurs writing to the client
-
writeClientWindowField
protected void writeClientWindowField(FacesContext context, ResponseWriter writer) throws IOExceptionWrite the client window state field.- Parameters:
context- the Faces context.writer- the response writer.- Throws:
IOException- when an I/O error occurs.
-