struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukasz Lenart <lukaszlen...@apache.org>
Subject Re: Struts seems to reset the action instance while its still in interceptor
Date Mon, 04 Nov 2013 10:10:58 GMT
2013/11/4 Ali Akhtar <ali.rac200@gmail.com>:
> no, pure struts. The class that it extends from is included in the same
> package. Not sure why it'd look like a singleton

First of all your interceptor is broken - each interceptor is a
singleton so you cannot change its state as thus will affect request
processing - which means you cannot assign action, request, whatever
to fields in interceptor and expect it will behave the same way as
usual ;-)

My example is using local reference to action and now everything is ok.

    public String intercept(ActionInvocation ai) throws Exception {
        AjaxAction action = (AjaxAction) ai.getAction();
        try {
            Thread.sleep(1000);
        } catch (Exception e) {
            e.printStackTrace();
        }

        String result = ai.invokeActionOnly();
        AjaxAction action2 = (AjaxAction) ai.getAction();
        if (!action.toString().equals(action2.toString())) {
            String error = "Original: " + action.toString() + ", now:
" + action2.toString();
            System.out.println(error);
        }
        System.out.println("result " + result);
        return null;
    }


Regards
-- 
Ɓukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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


Mime
View raw message