You are incorrect. Actions are instantiated per-request. Other than that, you will need to provide a working example that exhibits the incorrect behavior. On Nov 3, 2013 12:57 PM, "Ali Akhtar" <ali.rac...@gmail.com> wrote:
> Hello, > > It seems that if I have two concurrent requests being made to the same > action, e.g mysite.com/fooAction, 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.setAuth(auth); > 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 > data. > > 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. >