Hello,
    I'm starting to user WicketTester and I've hit the following behaviour.
I have a IRequestCycleListener wich needs to access to the httpSession. In my code I was using
    HttpSession httpSession=httpRequest.getSession();
which works fine within the real servlet container (i.e. tomcat) but fails when I use WicketTester
In order to make wicketteset work I had to change the previous line to:
    HttpSession httpSession=httpRequest.getSession(true);
But if I look at the servler api specs (http://docs.oracle.com/javaee/1.4/api/) the api says:

public HttpSession getSession()
Returns the current session associated with this request, or if the request does not have a session, creates one.

So as far as I understand
httpRequest.getSession(); and httpRequest.getSession(true); are equivalent

If my assumption is correct the MockHttpServletRequest implementation is incorrect since it returns null in my case.
The code in the mock class is the following one
    public HttpSession getSession()
    {
if (session instanceof MockHttpSession && ((MockHttpSession)session).isTemporary())
        {
            return null;
        }
        return session;
    }
Is it a bug or am I missing something?
ciao,
    Giovanni


--
Giovanni Cuccu
CUP 2000 Spa
Via del Borgo di S. Pietro, 90/c - 40126 Bologna
e-mail: giovanni.cuccu _at_ cup2000.it


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to