com.sun.faces.renderkit
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.
|
private static java.util.logging.Logger |
LOGGER |
static java.lang.String |
LOGICAL_VIEW_MAP
The top level attribute name for storing the state structures within
the session.
|
protected boolean |
namespaceParameters
Flag determining whether or not javax.faces.ViewState should be namespaced.
|
protected java.lang.Integer |
numberOfLogicalViews
The number of logical views as configured by the user.
|
protected java.lang.Integer |
numberOfViews
The number of views as configured by the user.
|
protected java.util.Random |
random
Used to generate unique server state IDs.
|
static java.lang.String |
STATEMANAGED_SERIAL_ID_KEY
Key to store the
AtomicInteger used to generate
unique state map keys. |
compressViewState, serialProvider, STATE_FIELD_AUTOCOMPLETE_END, STATE_FIELD_END, STATE_FIELD_START, STATE_FIELD_START_NO_ID, stateFieldEnd, stateFieldStart, webConfig
Constructor and Description |
---|
ServerSideStateHelper()
Construct a new
ServerSideStateHelper instance. |
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
createIncrementalRequestId(javax.faces.context.FacesContext ctx) |
private java.lang.String |
createRandomId() |
protected java.lang.Integer |
getIntegerConfigValue(WebConfiguration.WebContextInitParameter param)
Utility method for obtaining the
Integer based configuration
values used to change the behavior of the ServerSideStateHelper . |
java.lang.Object |
getState(javax.faces.context.FacesContext ctx,
java.lang.String viewId)
Inspects the incoming request parameters for the standardized state
parameter name.
|
protected java.lang.Object |
handleRestoreState(java.lang.Object state) |
protected java.lang.Object |
handleSaveState(java.lang.Object state) |
void |
writeState(javax.faces.context.FacesContext ctx,
java.lang.Object state,
java.lang.StringBuilder stateCapture)
Stores the provided state within the session obtained from the provided
FacesContext |
getStateParamValue, writeRenderKitIdField
private static final java.util.logging.Logger LOGGER
public static final java.lang.String STATEMANAGED_SERIAL_ID_KEY
AtomicInteger
used to generate
unique state map keys.public static final java.lang.String LOGICAL_VIEW_MAP
protected final java.lang.Integer numberOfLogicalViews
protected final java.lang.Integer numberOfViews
protected boolean generateUniqueStateIds
protected boolean namespaceParameters
protected final java.util.Random random
public ServerSideStateHelper()
ServerSideStateHelper
instance.public void writeState(javax.faces.context.FacesContext ctx, java.lang.Object state, java.lang.StringBuilder stateCapture) throws java.io.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 StateHelper
java.io.IOException
ResponseStateManager.writeState(javax.faces.context.FacesContext, java.lang.Object)
public java.lang.Object getState(javax.faces.context.FacesContext ctx, java.lang.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 StateHelper
ResponseStateManager.getState(javax.faces.context.FacesContext, String)
protected java.lang.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 java.lang.Object handleSaveState(java.lang.Object state)
state
- the object returned from UIView.processSaveState
WebConfiguration.BooleanWebContextInitParameter.SerializeServerState
is
true
, serialize and return the state, otherwise, return
state
unchanged.protected java.lang.Object handleRestoreState(java.lang.Object state)
state
- the state as it was stored in the sessionUIViewRoot.processRestoreState
.
If WebConfiguration.BooleanWebContextInitParameter.SerializeServerState
de-serialize the
state prior to returning it, otherwise return state
as is.private java.lang.String createIncrementalRequestId(javax.faces.context.FacesContext ctx)
ctx
- the FacesContext
for the current requestprivate java.lang.String createRandomId()
Copyright © 2002-2010 Oracle America, Inc. All Rights Reserved.