Top Description Fields Constructors Methods
com.sun.faces.renderkit

public abstract Class StateHelper

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.faces.renderkit.ClientSideStateHelper, com.sun.faces.renderkit.ServerSideStateHelper
Static Imports
com.sun.faces.config.WebConfiguration.BooleanWebContextInitParameter.AutoCompleteOffOnViewState, .WebConfiguration.BooleanWebContextInitParameter.CompressViewState, com.sun.faces.renderkit.RenderKitUtils.PredefinedPostbackParameter.CLIENT_WINDOW_PARAM, .RenderKitUtils.PredefinedPostbackParameter.RENDER_KIT_ID_PARAM, .RenderKitUtils.PredefinedPostbackParameter.VIEW_STATE_PARAM, java.nio.charset.StandardCharsets.UTF_8

Common code for the default StateHelper implementations.

Field Summary

Modifier and TypeField and Description
protected boolean
compressViewState

Flag indicating whether or not view state should be compressed to reduce the memory/bandwidth footprint.

protected char[]
fieldEnd

This will be used the by the different StateHelper implementations when writing the end of the state or viewId field.

protected char[]
fieldMiddle

This will be used by the different StateHelper implementations when writing the middle of the state or viewId fields.

private static final Logger
protected SerializationProvider
serialProvider

Factory for serialization streams.

protected char[]
stateFieldStart

This will be used the by the different StateHelper implementations when writing the start of the state field.

private static final String
protected WebConfiguration
webConfig

Access to the context init parameters that configure this application.

Constructor Summary

AccessConstructor and Description
public
StateHelper()

Constructs a new StateHelper instance.

Method Summary

Modifier and TypeMethod and Description
public static void
public String
public abstract Object
protected static String

Returns:

the view state from this request
getStateParamValue
(FacesContext
the FacesContext for the current request
context
)

Get our view state from this request

public abstract boolean
protected void
writeClientWindowField(FacesContext
the Faces context.
context
,
ResponseWriter
the response writer.
writer
)

Write the client window state field.

protected void
writeRenderKitIdField(FacesContext
the FacesContext for the current request
context
,
ResponseWriter
the ResponseWriter to write to
writer
)

If a custom RenderKit is used, write out the ID of the RenderKit out as a hidden field.

public abstract void
writeState(FacesContext ctx, Object state, StringBuilder stateCapture)

Functionally similar to ResponseStateManager#writeState(FacesContext, Object) with an option to write the state directly to the provided StringBuilder without sending any markup to the client.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

compressViewStateback to summary
protected boolean compressViewState

Flag 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.

fieldEndback to summary
protected char[] fieldEnd

This will be used the by the different StateHelper implementations when writing the end of the state or viewId field. This value of this field is determined by the value of the com.sun.faces.config.WebConfiguration.BooleanWebContextInitParameter#AutoCompleteOffOnViewState

fieldMiddleback to summary
protected char[] fieldMiddle

This will be used by the different StateHelper implementations when writing the middle of the state or viewId fields.

LOGGERback to summary
private static final Logger LOGGER
serialProviderback to summary
protected SerializationProvider serialProvider

Factory for serialization streams. These are pluggable via the WebConfiguration.WebContextInitParameter#SerializationProviderClass.

stateFieldStartback to summary
protected char[] stateFieldStart

This will be used the by the different StateHelper implementations when writing the start of the state field.

TOKEN_NAMEback to summary
private static final String TOKEN_NAME
webConfigback to summary
protected WebConfiguration webConfig

Access to the context init parameters that configure this application.

Constructor Detail

StateHelperback to summary
public StateHelper()

Constructs a new StateHelper instance.

Method Detail

createAndStoreCryptographicallyStrongTokenInSessionback to summary
public static void createAndStoreCryptographicallyStrongTokenInSession(HttpSession session)
getCryptographicallyStrongTokenFromSessionback to summary
public String getCryptographicallyStrongTokenFromSession(FacesContext context)
getStateback to summary
public abstract Object getState(FacesContext ctx, String viewId) throws IOException
See Also
jakarta.faces.render.ResponseStateManager#getState(jakarta.faces.context.FacesContext, String)
getStateParamValueback to summary
protected static String getStateParamValue(FacesContext context)

Get our view state from this request

Parameters
context:FacesContext

the FacesContext for the current request

Returns:String

the view state from this request

isStatelessback to summary
public abstract boolean isStateless(FacesContext ctx, String viewId) throws IllegalStateException
See Also
jakarta.faces.render.ResponseStateManager#isStateless(jakarta.faces.context.FacesContext, String)
writeClientWindowFieldback to summary
protected void writeClientWindowField(FacesContext context, ResponseWriter writer) throws IOException

Write the client window state field.

Parameters
context:FacesContext

the Faces context.

writer:ResponseWriter

the response writer.

Exceptions
IOException:
when an I/O error occurs.
writeRenderKitIdFieldback to summary
protected void writeRenderKitIdField(FacesContext context, ResponseWriter writer) throws IOException

If a custom RenderKit is used, write out the ID of the RenderKit out as a hidden field. This will be used when restoring the view state.

Parameters
context:FacesContext

the FacesContext for the current request

writer:ResponseWriter

the ResponseWriter to write to

Exceptions
IOException:
if an error occurs writing to the client
writeStateback to summary
public abstract void writeState(FacesContext ctx, Object state, StringBuilder stateCapture) throws IOException

Functionally similar to ResponseStateManager#writeState(FacesContext, Object) with an option to write the state directly to the provided StringBuilder without sending any markup to the client.

See Also
ResponseStateManager#writeState(jakarta.faces.context.FacesContext, java.lang.Object)