Yes I did. I was assuming that once newSession is called, on
subsequent calls, the session will be set on a thread local variable.
If that is not the case, what would be the right way to check if a
session has been created.

On Tue, Mar 11, 2008 at 10:32 AM, Martijn Dashorst
<[EMAIL PROTECTED]> wrote:
> Did you read the javadoc for Session#exists() ?
>
>  http://wicket.sourceforge.net/apidocs/wicket/Session.html#exists()
>
>  "Checks if the Session threadlocal is set in this thread"
>
>  So not if the session was created or not.
>
>  Martijn
>
>
>
>
>  On 3/11/08, Rajiv Jivan <[EMAIL PROTECTED]> wrote:
>  > I am having a tough time understanding how sessions are
>  >  created/managed specifically related to the calls
>  >
>  >  public RequestCycle newRequestCycle(Request request, Response response)
>  >
>  >  and
>  >
>  >  public Session newSession(Request request, Response response)
>  >
>  >  I am creating a new session by overriding the method newSession and
>  >  doing something like
>  >
>  >  public Session newSession(Request request, Response response) {
>  >    ......
>  >    Session session = new Session(request);
>  >    return session;
>  >  }
>  >
>  >  This works fine. On subsequent calls, newSession isn't called as a
>  >  session is already in place. This is working as expected.
>  >
>  >  What isn't working is the call
>  >  to Session.exists(), this is always returning false when its invoked
>  >  in the method newRequestCycle which I override.
>  >
>  >  public RequestCycle newRequestCycle(Request request, Response response) {
>  >     if(Session.exists() && <certain condiition is met>) {   <----- The
>  >  method Session.exists() is always returning false
>  >          Session  mySession = Session.get();
>  >          mySession.invalidateNow();
>  >     }
>  >  }
>  >  }
>  >
>  >  Can someone explain why Session.exists() always returns false, and if
>  >  the session truly doesn't exist why newSession isn't called after the
>  >  first invocation
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  >  For additional commands, e-mail: [EMAIL PROTECTED]
>  >
>  >
>
>
>  --
>  Buy Wicket in Action: http://manning.com/dashorst
>  Apache Wicket 1.3.1 is released
>  Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.1
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to