struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gabriel Belingueres" <belingue...@gmail.com>
Subject Re: [S2] newly-created Session context
Date Mon, 14 Jul 2008 18:50:19 GMT
Where in the interceptor chain do your custom interceptor execute?

2008/7/14 Pierre Thibaudeau <pierre.thibaudeau@gmail.com>:
> I have an interceptor that puts an object in the Session scope.
>
> The interceptor calls the following when retrieving the Session:
>
>    public String intercept(ActionInvocation invocation) throws Exception {
>        ActionContext context = invocation.getInvocationContext();
>        HttpServletRequest request = (HttpServletRequest)
> context.get(StrutsStatics.HTTP_REQUEST);
>        HttpSession session = request.getSession(true /* create if need be
> */);
>        session.setAttribute(attributeName, someObject);
>        ...
>    }
>
> Given that code, I don't see how the Session could be null after that
> interception --- otherwise an exception would be thrown at the point when I
> attempt to set the Session attribute.
>
> Yet, immediately after I start the server (therefore no Session has yet been
> created), if I issue a browser request on an action that uses that
> interceptor, OGNL reports the Session as being indeed null --- or so the
> xml-debug output of the context shows.  It's only on the second request that
> the xml-debug shows a Session context containing the desired object.
>
> Is there a way of explaining this discrepancy?
> Apart from this custom interceptor, I use the paramPrepareParam stack.
> Would there be another interceptor in there interfering with my custom
> newly-created Session (but not interfering when the Session is not new
> anymore)?
>
> Toughts?
>

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


Mime
View raw message