struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ali Akhtar <>
Subject Struts seems to reset the action instance while its still in interceptor
Date Sun, 03 Nov 2013 17:57:18 GMT

It seems that if I have two concurrent requests being made to the same
action, e.g, then struts resets the first action's
instance while that instance may still be in the interceptor.

E.g, if I have the following code in my interceptor:

    action =  ai.getAction();
    String result = ai.invoke();
    logger.debug("Orig action : " + action.toString()  +" , now : " +
ai.getAction().toString() );

And if I make two concurrent requests to the same action (e.g using
javascript), then the line:

    logger.debug("Orig action : " + action.toString()  +" , now : " +
ai.getAction().toString() );

will sometimes produce two different `toString()` codes, showing that the
original action was in a different instance than the last action.

This is a big problem, because now, if I had any code in the interceptor,
which was setting certain things on my action, e.g doing the following:

    MyAction action =  (MyAction) ai.getAction();
    Auth auth = new Auth ( action.getSession() );
    action.setCookiesMap( Util.getAllCookies() );
    String result = ai.invoke();

then there is no guarantee that all those things which I've set on my
action are in fact going to be passed to the correct instance. I.e, when
`ai.invoke()` is called, it may in fact call a completely different
instance of the action, which has different cookies or other data set on
it. This could result in different users being given access to each other's

Am I correct in all of this? If so, is there a solution to this problem?
Because this seems to completely defeat the purpose of interceptors.

Thanks in advance.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message