|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfc.web.servlet.TransactionToken
public class TransactionToken
Modified version of CommandToken class from the book:
Web dev. with JSP by fields, kolb and bayernUses
JDBCSession to store data.
Thread safety: Methods in this class are not thread safe and should be called via higher level synchronization (typically on the session object for a given user);
| Field Summary | |
|---|---|
static String |
TransactionToken_Key
The token is stored in the session with this key |
| Constructor Summary | |
|---|---|
TransactionToken()
|
|
| Method Summary | |
|---|---|
static void |
create(Connection con,
String sessionID)
Creates a new transactional token. |
static boolean |
isValid(Connection con,
String sessionID,
javax.servlet.http.HttpServletRequest req)
Searches for a token in the request (under the parameter name TransactionToken_Key and tries to match it with a
corresponding token in the session. |
static void |
main(String[] args)
|
static void |
revoke(Connection con,
String sessionID)
Revokes the transactionID (if any) from the session data |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String TransactionToken_Key
| Constructor Detail |
|---|
public TransactionToken()
| Method Detail |
|---|
public static void create(Connection con,
String sessionID)
throws SQLException
con - connection to database used by JDBCSessionsessionID - the sessionID of the client
IllegalStateException - if the specified sessionID does
not exist in the database
SQLException
public static void revoke(Connection con,
String sessionID)
throws SQLException
session - the JDBC session to save the token tosessionID - the sessionID of the client
SQLException
public static boolean isValid(Connection con,
String sessionID,
javax.servlet.http.HttpServletRequest req)
throws SQLException
TransactionToken_Key and tries to match it with a
corresponding token in the session. Returns true if the
tokens match (and hence the token is valid), false
otherwise.
SQLException
public static void main(String[] args)
throws Exception
Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||