struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pierre Thibaudeau" <pierre.thibaud...@gmail.com>
Subject [S2] newly-created Session context
Date Mon, 14 Jul 2008 17:20:01 GMT
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?

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