HDIV API 2.0.4

org.hdiv.state
Class StateUtil

java.lang.Object
  extended by org.hdiv.state.StateUtil

public class StateUtil
extends java.lang.Object

Class containing utility methods for state.

Author:
Roberto Velasco

Constructor Summary
StateUtil()
           
 
Method Summary
 EncodingUtil getEncodingUtil()
           
 java.lang.String getHDIVParameter()
           
 void init()
          StateUtil initialization with HDIV parameter name stored in http session.
 boolean isMemoryStrategy(java.lang.String value)
          Checks if the memory strategy is being used
 IState restoreHashState(java.lang.String value)
          Checks if the state hash received from the client and the hash stored in session match.
 IState restoreState(java.lang.String requestState)
          Restore state data from request.
 void setEncodingUtil(EncodingUtil encodingUtil)
           
 void setHDIVParameter(java.lang.String parameter)
           
 void setStrategy(java.lang.String strategy)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StateUtil

public StateUtil()
Method Detail

init

public void init()
StateUtil initialization with HDIV parameter name stored in http session.


restoreState

public IState restoreState(java.lang.String requestState)
Restore state data from request. State restore from memory can be done using an identifier or or using the serialized data received in the request.

Parameters:
requestState - String that contains HDIV state received in the request
Returns:
State Restore state data from request.
Throws:
HDIVException - If the state doesn't exist a new HDIV exception is thrown.

isMemoryStrategy

public boolean isMemoryStrategy(java.lang.String value)
Checks if the memory strategy is being used

Returns:
True if strategy is memory. False in otherwise.

restoreHashState

public IState restoreHashState(java.lang.String value)
Checks if the state hash received from the client and the hash stored in session match. If it is true, an object of type IState is returned. Otherwise, a HDIVException is thrown.

Parameters:
value - State received in the request encoded in Base64
Returns:
Decoded state of type IState obtained from value

getHDIVParameter

public java.lang.String getHDIVParameter()
Returns:
Returns the HDIV state parameter.

setHDIVParameter

public void setHDIVParameter(java.lang.String parameter)
Parameters:
parameter - The hDIVParameter to set.

getEncodingUtil

public EncodingUtil getEncodingUtil()
Returns:
Returns the encoding util.

setEncodingUtil

public void setEncodingUtil(EncodingUtil encodingUtil)
Parameters:
encodingUtil - The encodingUtil to set.

setStrategy

public void setStrategy(java.lang.String strategy)
Parameters:
strategy - The strategy to set.

HDIV 2.0.4

Copyright © 2008 hdiv.org. All Rights Reserved.