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?

Reply via email to