IBM Branch Transformation Toolkit Javadoc

com.ibm.btt.struts.utils
Class BTTTokenProcessor

java.lang.Object
  extended bycom.ibm.btt.struts.utils.BTTTokenProcessor

public class BTTTokenProcessor
extends java.lang.Object


Constructor Summary
protected BTTTokenProcessor()
          Protected constructor for TokenProcessor.
 
Method Summary
 java.lang.String generateToken(javax.servlet.http.HttpServletRequest request)
          Generate a new transaction token, to be used for enforcing a single request for a particular transaction.
static BTTTokenProcessor getInstance()
          Retrieves the singleton instance of this class.
 boolean isTokenValid(javax.servlet.http.HttpServletRequest request, boolean reset, java.lang.String actionName)
          Return true if there is a transaction token stored in the user's current session, and the value submitted as a request parameter with this action matches it.
 boolean isTokenValid(javax.servlet.http.HttpServletRequest request, java.lang.String actionName)
          Return true if there is a transaction token stored in the user's current session, and the value submitted as a request parameter with this action matches it.
 void resetToken(javax.servlet.http.HttpServletRequest request, java.lang.String actionName)
          Reset the saved transaction token in the user's session.
 void saveToken(javax.servlet.http.HttpServletRequest request)
          Save a new transaction token in the user's current session, creating a new session if necessary.
 java.lang.String toHex(byte[] buffer)
          Convert a byte array to a String of hexadecimal digits and return it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BTTTokenProcessor

protected BTTTokenProcessor()
Protected constructor for TokenProcessor. Use TokenProcessor.getInstance() to obtain a reference to the processor.

Method Detail

getInstance

public static BTTTokenProcessor getInstance()
Retrieves the singleton instance of this class.


isTokenValid

public boolean isTokenValid(javax.servlet.http.HttpServletRequest request,
                            java.lang.String actionName)
Return true if there is a transaction token stored in the user's current session, and the value submitted as a request parameter with this action matches it. Returns false under any of the following circumstances:

Parameters:
request - The servlet request we are processing

isTokenValid

public boolean isTokenValid(javax.servlet.http.HttpServletRequest request,
                            boolean reset,
                            java.lang.String actionName)
Return true if there is a transaction token stored in the user's current session, and the value submitted as a request parameter with this action matches it. Returns false

Parameters:
request - The servlet request we are processing
reset - Should we reset the token after checking it?

resetToken

public void resetToken(javax.servlet.http.HttpServletRequest request,
                       java.lang.String actionName)
Reset the saved transaction token in the user's session. This indicates that transactional token checking will not be needed on the next request that is submitted.

Parameters:
request - The servlet request we are processing

saveToken

public void saveToken(javax.servlet.http.HttpServletRequest request)
Save a new transaction token in the user's current session, creating a new session if necessary.

Parameters:
request - The servlet request we are processing

generateToken

public java.lang.String generateToken(javax.servlet.http.HttpServletRequest request)
Generate a new transaction token, to be used for enforcing a single request for a particular transaction.

Parameters:
request - The request we are processing

toHex

public java.lang.String toHex(byte[] buffer)
Convert a byte array to a String of hexadecimal digits and return it.

WARNING: This method is not part of TokenProcessor's public API. It's provided for backward compatibility only.

Parameters:
buffer - The byte array to be converted

IBM Branch Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2005