You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Th...@swisslife.ch on 2007/08/27 10:09:24 UTC

Transaction Token Problem

Hi, 
Im having some trouble implementing the Transaction Token into my
Application. 
Ive checked the Data that is being written - and it seems one of the
session-keys isnt being written.
 
        HttpSession session1 = req.getSession(false);
        String saved1 = (String)
session1.getAttribute(Globals.TRANSACTION_TOKEN_KEY);
        System.out.println("ReqIN======================"+ saved1);
        String tokenBefore = req.getParameter(Globals.TOKEN_KEY);
 
System.out.println("ReqIN-RequestTokenBeforeSave:======================"
+ tokenBefore);
     saveToken(req);
        String tokenAfter = req.getParameter(Globals.TOKEN_KEY);
 
System.out.println("ReqIN-RequestTokenAfterSave:======================"+
tokenAfter);
        HttpSession session2 = req.getSession(false);
        String saved2 = (String)
session2.getAttribute(Globals.TRANSACTION_TOKEN_KEY);
        System.out.println("ReqIN======================"+ saved2);
 
saveToken seems to save the Globals.TRANSACTION_TOKEN_KEY correctly -
but the Globals.TOKEN_KEY always stays empty...
how can this be? and how can I fix that?
 
thanks guys.
 
regards, Tom

Re: Transaction Token Problem

Posted by Paul Benedict <pb...@apache.org>.
Laurie is correct.

Globals.TRANSACTION_TOKEN_KEY = the value of the token stored in the session
Globals.TOKEN_KEY = the name of the request parameter which will be
submitted back with the token.

If the named parameter (it's not Globals.TOKEN_KEY but the value of the
constant) does not contain the matching token, it will not succeed.

Paul

On 8/28/07, Laurie Harper <la...@holoweb.net> wrote:
>
> Thomas.Zygadlewicz@swisslife.ch wrote:
> > Hi,
> > Im having some trouble implementing the Transaction Token into my
> > Application.
> > Ive checked the Data that is being written - and it seems one of the
> > session-keys isnt being written.
> >
> >         HttpSession session1 = req.getSession(false);
> >         String saved1 = (String)
> > session1.getAttribute(Globals.TRANSACTION_TOKEN_KEY);
> >         System.out.println("ReqIN======================"+ saved1);
> >         String tokenBefore = req.getParameter(Globals.TOKEN_KEY);
> >
> > System.out.println("ReqIN-RequestTokenBeforeSave:======================"
> > + tokenBefore);
> >      saveToken(req);
> >         String tokenAfter = req.getParameter(Globals.TOKEN_KEY);
> >
> > System.out.println("ReqIN-RequestTokenAfterSave:======================"+
> > tokenAfter);
> >         HttpSession session2 = req.getSession(false);
> >         String saved2 = (String)
> > session2.getAttribute(Globals.TRANSACTION_TOKEN_KEY);
> >         System.out.println("ReqIN======================"+ saved2);
> >
> > saveToken seems to save the Globals.TRANSACTION_TOKEN_KEY correctly -
> > but the Globals.TOKEN_KEY always stays empty...
> > how can this be? and how can I fix that?
> >
> > thanks guys.
> >
> > regards, Tom
>
> What are you expecting to happen? AFAIK, saveToken() just saves a new
> token value to the session under the key Globals.TRANSACTION_TOKEN_KEY.
> Globals.TOKEN_KEY is described as "The property under which a
> transaction token is reported." which doesn't tell us much, but doesn't
> mention the session either...
>
> L.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Transaction Token Problem

Posted by Laurie Harper <la...@holoweb.net>.
Thomas.Zygadlewicz@swisslife.ch wrote:
> Hi, 
> Im having some trouble implementing the Transaction Token into my
> Application. 
> Ive checked the Data that is being written - and it seems one of the
> session-keys isnt being written.
>  
>         HttpSession session1 = req.getSession(false);
>         String saved1 = (String)
> session1.getAttribute(Globals.TRANSACTION_TOKEN_KEY);
>         System.out.println("ReqIN======================"+ saved1);
>         String tokenBefore = req.getParameter(Globals.TOKEN_KEY);
>  
> System.out.println("ReqIN-RequestTokenBeforeSave:======================"
> + tokenBefore);
>      saveToken(req);
>         String tokenAfter = req.getParameter(Globals.TOKEN_KEY);
>  
> System.out.println("ReqIN-RequestTokenAfterSave:======================"+
> tokenAfter);
>         HttpSession session2 = req.getSession(false);
>         String saved2 = (String)
> session2.getAttribute(Globals.TRANSACTION_TOKEN_KEY);
>         System.out.println("ReqIN======================"+ saved2);
>  
> saveToken seems to save the Globals.TRANSACTION_TOKEN_KEY correctly -
> but the Globals.TOKEN_KEY always stays empty...
> how can this be? and how can I fix that?
>  
> thanks guys.
>  
> regards, Tom

What are you expecting to happen? AFAIK, saveToken() just saves a new 
token value to the session under the key Globals.TRANSACTION_TOKEN_KEY. 
Globals.TOKEN_KEY is described as "The property under which a 
transaction token is reported." which doesn't tell us much, but doesn't 
mention the session either...

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org