Hi,

If mockHttpSession is temporary then it is not bound and calling
getSession(false) will not return it.
You have to call getSession()/getSession(true) to bind it and from there on
getSession(false) will return it.


On Fri, Dec 14, 2012 at 12:51 PM, Leonardo D'Alimonte <
[email protected]> wrote:

> Hi guys,
> I have a problem with the implementation of
> MockHttpServletRequest.getSession(boolean):
>
>                 HttpSession sess = null;
>                 if (session instanceof MockHttpSession)
>                 {
>                         MockHttpSession mockHttpSession =
> (MockHttpSession) session;
>                         if (b)
>                         {
>                                 mockHttpSession.setTemporary(false);
>                         }
>
>                         if (mockHttpSession.isTemporary() == false)
>                         {
>                                 sess = session;
>                         }
>                 }
>                 return sess;
>
> With parameter false, i never get the session even if it actually exists.
> Field "session" is an instance of MockHttpSession, the first "if" is never
> executed with boolean "false" and so also the second one..thus session
> remain null.
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Possibile-bug-in-MockHttpServletRequest-tp4340419p4654811.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Reply via email to