org.apache.struts.util
クラス TokenProcessor

java.lang.Object
  拡張org.apache.struts.util.TokenProcessor

public class TokenProcessor
extends java.lang.Object

TokenProcessor is responsible for handling all token related functionality. The methods in this class are synchronized to protect token processing from multiple threads. Servlet containers are allowed to return a different HttpSession object for two threads accessing the same session so it is not possible to synchronize on the session.

導入されたバージョン:
Struts 1.1

フィールドの概要
private static TokenProcessor instance
          The singleton instance of this class.
private  long previous
          The timestamp used most recently to generate a token value.
 
コンストラクタの概要
protected TokenProcessor()
          Protected constructor for TokenProcessor.
 
メソッドの概要
 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 TokenProcessor getInstance()
          Retrieves the singleton instance of this class.
 boolean isTokenValid(javax.servlet.http.HttpServletRequest request)
          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, boolean reset)
          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)
          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.
private  java.lang.String toHex(byte[] buffer)
          Convert a byte array to a String of hexadecimal digits and return it.
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

instance

private static TokenProcessor instance
The singleton instance of this class.


previous

private long previous
The timestamp used most recently to generate a token value.

コンストラクタの詳細

TokenProcessor

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

メソッドの詳細

getInstance

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


isTokenValid

public boolean isTokenValid(javax.servlet.http.HttpServletRequest request)
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:

パラメータ:
request - The servlet request we are processing

isTokenValid

public boolean isTokenValid(javax.servlet.http.HttpServletRequest request,
                            boolean reset)
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

パラメータ:
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)
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.

パラメータ:
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.

パラメータ:
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.

パラメータ:
request - The request we are processing

toHex

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

パラメータ:
buffer - The byte array to be converted


このドキュメントは、Ja-Jakartaにより訳されました。コメントがある場合は、report@jajakarta.orgまでお願いします。
Copyright (C) 2000-2004 - Apache Software Foundation