This StateHelper provides the functionality associated with client-side state saving.
| Modifier and Type | Class and Description |
|---|---|
| protected static class | ClientSideStateHelper.StringBuilderWriter
A simple |
| Modifier and Type | Field and Description |
|---|---|
| private int | csBuffSize
Client state is generally large, so this allows some tuning to control the buffer that's used to write the client state. |
| private boolean | |
| private ByteArrayGuard | guard
Enabled encryption of view state. |
| private static final Logger | |
| private long | stateTimeout
If |
| private boolean | stateTimeoutEnabled
Flag indicating whether or not client view state will be manipulated for and checked against a configured timeout value. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected Object | Returns: the view state reconstructed fromstateStringthe Base64 encoded view state stateString)Rebuilds the view state from the Base64 included String included with the request. |
| protected void | doWriteState(FacesContext
the Faces context. facesContext, Object view state state, Writer the writer)Writer to write the content toSerializes and Base64 encodes the provided |
| public Object | getState(FacesContext ctx, String viewId)
Implements abstract com. Inspects the incoming request parameters for the standardized state parameter name. |
| protected boolean | Returns: false if the client state hasn't timed out, otherwise
return truethe time in milliseconds that the state was written
to the client stateTime)If the |
| protected void | |
| public boolean | Returns: true if stateless, false otherwise.the Faces context. facesContext, String the view id. viewId)Implements abstract com. |
| public void | writeState(FacesContext ctx, Object state, StringBuilder stateCapture)
Implements abstract com.
Writes the view state as a String generated by Base64 encoding the
Java Serialziation representation of the provided If |
| csBuffSize | back to summary |
|---|---|
| private int csBuffSize Client state is generally large, so this allows some tuning to control the buffer that's used to write the client state. The value specified must be divisable by two as the buffer is split between character and bytes (due to how client state is written). By default, the buffer size is 8192 (per request). | |
| debugSerializedState | back to summary |
|---|---|
| private boolean debugSerializedState | |
| guard | back to summary |
|---|---|
| private ByteArrayGuard guard Enabled encryption of view state. Encryption is disabled by default. | |
| LOGGER | back to summary |
|---|---|
| private static final Logger LOGGER | |
| stateTimeout | back to summary |
|---|---|
| private long stateTimeout
If | |
| stateTimeoutEnabled | back to summary |
|---|---|
| private boolean stateTimeoutEnabled Flag indicating whether or not client view state will be manipulated for and checked against a configured timeout value.
This flag is configured via the | |
| ClientSideStateHelper | back to summary |
|---|---|
| public ClientSideStateHelper() Construct a new | |
| doGetState | back to summary |
|---|---|
| protected Object doGetState(FacesContext ctx, String stateString) Rebuilds the view state from the Base64 included String included with the request. | |
| doWriteState | back to summary |
|---|---|
| protected void doWriteState(FacesContext facesContext, Object state, Writer writer) throws IOException Serializes and Base64 encodes the provided
| |
| getState | back to summary |
|---|---|
| public Object getState(FacesContext ctx, String viewId) throws IOException Implements abstract com. Inspects the incoming request parameters for the standardized state parameter name. In this case, the parameter value will be a Base64 encoded string previously encoded by ServerSideStateHelper#writeState(FacesContext, Object, StringBuilder). The string will be Base64-decoded and the state reconstructed using standard Java serialization.
| |
| hasStateExpired | back to summary |
|---|---|
| protected boolean hasStateExpired(long stateTime) If the
| |
| init | back to summary |
|---|---|
| protected void init() Initialze the various configuration options for client-side sate saving. | |
| isStateless | back to summary |
|---|---|
| public boolean isStateless(FacesContext facesContext, String viewId) throws IllegalStateException Implements abstract com. Is stateless.
| |
| writeState | back to summary |
|---|---|
| public void writeState(FacesContext ctx, Object state, StringBuilder stateCapture) throws IOException Implements abstract com.
Writes the view state as a String generated by Base64 encoding the
Java Serialziation representation of the provided If If | |
Writer implementation to encapsulate a
StringBuilder instance.
| Modifier and Type | Field and Description |
|---|---|
| private StringBuilder |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public Writer | append(CharSequence
The character sequence to append. If csq)csq is
null, then the four characters "null" are
appended to this writer.Overrides java. Implements java. |
| public Writer | append(CharSequence
The character sequence from which a subsequence will be
appended. If csq, int csq is null, then characters
will be appended as if csq contained the four
characters "null".The index of the first character in the subsequence start, int The index of the character following the last character in the
subsequence end)Overrides java. Implements java. |
| public Writer | append(char
The 16-bit character to append c)Overrides java. Implements java. |
| public void | close()
Implements abstract java. Implements java. |
| public void | flush()
Implements abstract java. Implements java. |
| public void | write(int
int specifying a character to be written c)Overrides java. |
| public void | write(char[]
Array of characters to be written cbuf)Overrides java. |
| public void | |
| public void | write(String
A String str, int Offset from which to start writing characters off, int Number of characters to write len)Overrides java. |
| public void | write(char[]
Array of characters cbuf, int Offset from which to start writing characters off, int Number of characters to write len)Implements abstract java. |
| sb | back to summary |
|---|---|
| private StringBuilder sb | |
| StringBuilderWriter | back to summary |
|---|---|
| protected StringBuilderWriter(StringBuilder sb) | |
| append | back to summary |
|---|---|
| public Writer append(CharSequence csq) throws IOException Overrides java. Implements java. Doc from java. Appends the specified character sequence to this writer. An invocation of this method of the form out.write(csq.toString()) Depending on the specification of
| |
| append | back to summary |
|---|---|
| public Writer append(CharSequence csq, int start, int end) throws IOException Overrides java. Implements java. Doc from java. Appends a subsequence of the specified character sequence to this writer.
An invocation of this method of the form
out.write(csq.subSequence(start, end).toString())
| |
| append | back to summary |
|---|---|
| public Writer append(char c) throws IOException Overrides java. Implements java. Doc from java. Appends the specified character to this writer. An invocation of this method of the form out.write(c)
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Implements abstract java. Implements java. Doc from java. Closes the stream, flushing it first. Once the stream has been closed, further write() or flush() invocations will cause an IOException to be thrown. Closing a previously closed stream has no effect.
| |
| flush | back to summary |
|---|---|
| public void flush() throws IOException Implements abstract java. Implements java. Doc from java. Flushes the stream. If the stream has saved any characters from the various write() methods in a buffer, write them immediately to their intended destination. Then, if that destination is another character or byte stream, flush it. Thus one flush() invocation will flush all the buffers in a chain of Writers and OutputStreams. If the intended destination of this stream is an abstraction provided by the underlying operating system, for example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to the operating system for writing; it does not guarantee that they are actually written to a physical device such as a disk drive.
| |
| write | back to summary |
|---|---|
| public void write(int c) throws IOException Overrides java. Doc from java. Writes a single character. The character to be written is contained in the 16 low-order bits of the given integer value; the 16 high-order bits are ignored. Subclasses that intend to support efficient single-character output should override this method.
| |
| write | back to summary |
|---|---|
| public void write(char[] cbuf) throws IOException Overrides java. Doc from java. Writes an array of characters.
| |
| write | back to summary |
|---|---|
| public void write(String str) throws IOException Overrides java. Doc from java. Writes a string.
| |
| write | back to summary |
|---|---|
| public void write(String str, int off, int len) throws IOException Overrides java. Doc from java. Writes a portion of a string.
| |
| write | back to summary |
|---|---|
| public void write(char[] cbuf, int off, int len) throws IOException Implements abstract java. Doc from java. Writes a portion of an array of characters.
| |