public class ServerSideStateHelper extends StateHelper
This StateHelper provides the functionality associated with server-side state saving, though in
actuallity, it is a hybrid between client and server.
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
generateUniqueStateIds
Flag determining how server state IDs are generated.
|
static String |
LOGICAL_VIEW_MAP
The top level attribute name for storing the state structures within the session.
|
protected Integer |
numberOfLogicalViews
The number of logical views as configured by the user.
|
protected Integer |
numberOfViews
The number of views as configured by the user.
|
protected SecureRandom |
random
Used to generate unique server state IDs.
|
static String |
STATEMANAGED_SERIAL_ID_KEY
Key to store the
AtomicInteger used to generate unique state map keys. |
compressViewState, fieldEnd, fieldMiddle, serialProvider, stateFieldStart, webConfig| Constructor and Description |
|---|
ServerSideStateHelper()
Construct a new
ServerSideStateHelper instance. |
| Modifier and Type | Method and Description |
|---|---|
protected Integer |
getIntegerConfigValue(WebConfiguration.WebContextInitParameter param)
Utility method for obtaining the
Integer based configuration values used to change the behavior of the
ServerSideStateHelper. |
Object |
getState(jakarta.faces.context.FacesContext ctx,
String viewId)
Inspects the incoming request parameters for the standardized state parameter name.
|
protected Object |
handleRestoreState(Object state) |
protected Object |
handleSaveState(Object state) |
boolean |
isStateless(jakarta.faces.context.FacesContext facesContext,
String viewId)
Is stateless.
|
void |
writeState(jakarta.faces.context.FacesContext ctx,
Object state,
StringBuilder stateCapture)
Stores the provided state within the session obtained from the provided
FacesContext |
createAndStoreCryptographicallyStrongTokenInSession, getCryptographicallyStrongTokenFromSession, getStateParamValue, writeClientWindowField, writeRenderKitIdFieldpublic static final String STATEMANAGED_SERIAL_ID_KEY
AtomicInteger used to generate unique state map keys.public static final String LOGICAL_VIEW_MAP
protected final Integer numberOfLogicalViews
protected final Integer numberOfViews
protected boolean generateUniqueStateIds
protected final SecureRandom random
public ServerSideStateHelper()
ServerSideStateHelper instance.public void writeState(jakarta.faces.context.FacesContext ctx,
Object state,
StringBuilder stateCapture)
throws IOException
Stores the provided state within the session obtained from the provided FacesContext
If stateCapture is null, the composite key used to look up the actual and logical views
will be written to the client as a hidden field using the ResponseWriter from the provided
FacesContext.
If stateCapture is not null, the composite key will be appended to the
StringBuilder without any markup included or any content written to the client.
writeState in class StateHelperIOExceptionResponseStateManager.writeState(jakarta.faces.context.FacesContext, java.lang.Object)public Object getState(jakarta.faces.context.FacesContext ctx, String viewId)
Inspects the incoming request parameters for the standardized state parameter name. In this case, the parameter value will be the composite ID generated by ServerSideStateHelper#writeState(FacesContext, Object, StringBuilder).
The composite key will be used to find the appropriate view within the session obtained from the provided
FacesContext
getState in class StateHelperResponseStateManager.getState(jakarta.faces.context.FacesContext, String)protected Integer getIntegerConfigValue(WebConfiguration.WebContextInitParameter param)
Utility method for obtaining the Integer based configuration values used to change the behavior of the
ServerSideStateHelper.
param - the paramter to parseprotected Object handleSaveState(Object state)
state - the object returned from UIView.processSaveStateWebConfiguration.BooleanWebContextInitParameter.SerializeServerStateDeprecated is
true, serialize and return the state, otherwise, return state unchanged.protected Object handleRestoreState(Object state)
state - the state as it was stored in the sessionUIViewRoot.processRestoreState. If
WebConfiguration.BooleanWebContextInitParameter.SerializeServerStateDeprecated
de-serialize the state prior to returning it, otherwise return state as is.public boolean isStateless(jakarta.faces.context.FacesContext facesContext,
String viewId)
throws IllegalStateException
isStateless in class StateHelperfacesContext - the Faces context.viewId - the view id.IllegalStateException - when the request was not a postback.ResponseStateManager.isStateless(jakarta.faces.context.FacesContext, String)Copyright © 2010–2022 JBoss by Red Hat. All rights reserved.