Class StateHelper
- java.lang.Object
-
- com.sun.faces.renderkit.StateHelper
-
- Direct Known Subclasses:
ClientSideStateHelper
,ServerSideStateHelper
public abstract class StateHelper extends Object
Common code for the defaultStateHelper
implementations.
-
-
Field Summary
Fields Modifier and Type Field 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 differentStateHelper
implementations when writing the end of the state or viewId field.protected char[]
fieldMiddle
This will be used by the differentStateHelper
implementations when writing the middle of the state or viewId fields.protected SerializationProvider
serialProvider
Factory for serialization streams.protected char[]
stateFieldStart
This will be used the by the differentStateHelper
implementations when writing the start of the state field.protected WebConfiguration
webConfig
Access to the context init parameters that configure this application.
-
Constructor Summary
Constructors Constructor Description StateHelper()
Constructs a newStateHelper
instance.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static void
createAndStoreCryptographicallyStrongTokenInSession(jakarta.servlet.http.HttpSession session)
String
getCryptographicallyStrongTokenFromSession(FacesContext context)
abstract Object
getState(FacesContext ctx, String viewId)
protected static String
getStateParamValue(FacesContext context)
Get our view state from this requestabstract boolean
isStateless(FacesContext ctx, String viewId)
protected void
writeClientWindowField(FacesContext context, ResponseWriter writer)
Write the client window state field.protected void
writeRenderKitIdField(FacesContext context, ResponseWriter writer)
If a customRenderKit
is used, write out the ID of theRenderKit
out as a hidden field.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 providedStringBuilder
without sending any markup to the client.
-
-
-
Field Detail
-
serialProvider
protected SerializationProvider serialProvider
Factory for serialization streams. These are pluggable via the WebConfiguration.WebContextInitParameter#SerializationProviderClass.
-
webConfig
protected WebConfiguration webConfig
Access to the context init parameters that configure this application.
-
compressViewState
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.
-
stateFieldStart
protected char[] stateFieldStart
This will be used the by the differentStateHelper
implementations when writing the start of the state field.
-
fieldMiddle
protected char[] fieldMiddle
This will be used by the differentStateHelper
implementations when writing the middle of the state or viewId fields.
-
fieldEnd
protected char[] fieldEnd
This will be used the by the differentStateHelper
implementations when writing the end of the state or viewId field. This value of this field is determined by the value of theWebConfiguration.BooleanWebContextInitParameter.AutoCompleteOffOnViewState
-
-
Method Detail
-
createAndStoreCryptographicallyStrongTokenInSession
public static void createAndStoreCryptographicallyStrongTokenInSession(jakarta.servlet.http.HttpSession session)
-
getCryptographicallyStrongTokenFromSession
public String getCryptographicallyStrongTokenFromSession(FacesContext context)
-
writeState
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.
-
getState
public abstract Object getState(FacesContext ctx, String viewId) throws IOException
-
isStateless
public abstract boolean isStateless(FacesContext ctx, String viewId) throws IllegalStateException
-
getStateParamValue
protected static String getStateParamValue(FacesContext context)
Get our view state from this request
- Parameters:
context
- theFacesContext
for the current request- Returns:
- the view state from this request
-
writeRenderKitIdField
protected void writeRenderKitIdField(FacesContext context, ResponseWriter writer) throws IOException
If a custom
RenderKit
is used, write out the ID of theRenderKit
out as a hidden field. This will be used when restoring the view state.- Parameters:
context
- theFacesContext
for the current requestwriter
- theResponseWriter
to write to- Throws:
IOException
- if an error occurs writing to the client
-
writeClientWindowField
protected void writeClientWindowField(FacesContext context, ResponseWriter writer) throws IOException
Write the client window state field.- Parameters:
context
- the Faces context.writer
- the response writer.- Throws:
IOException
- when an I/O error occurs.
-
-