You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Martin A <wm...@gmail.com> on 2012/03/07 17:35:03 UTC

NullPointerException at Session line 492 - current RequestCycle is null

Hello,
I've got a REST service which is behind a Wicket Session Filter (due to the
need to obtain the wicket current session at the service), and this REST
service is being periodically hit by a Flash client (embedded in wicket
page)
At this REST service I've got a method that retrieves the wicket session,
and it holds this snippet of code:

    if (session.hasExpired()) {
      session.invalidateNow();
      throw new SessionExpiredException();
    }

The reason I do this and rely not on wicket's session timeout is because
Wicket will create a new session if previous one is expired, so it'll lack
all data I've stored in the session.

The problem is that, this piece of code being called by the client via the
REST service throws NullPointerException at Session line 492, which means
that current RequestCycle is null. This happens due to calling
invalidateNow(). I'm using wicket 1.5.0.

Would you please tell me how to invalidate the session immediately in this
case?

Best regards,
Martin

Re: NullPointerException at Session line 492 - current RequestCycle is null

Posted by Martin A <wm...@gmail.com>.
Thanks,
I wonder if I use invalidate() it would throw an error. I'll give it a try.

Best regards,
Martin

On Thu, Mar 8, 2012 at 2:39 PM, Martin Grigorov <mg...@apache.org>wrote:

> Hi,
>
> You can invalidate the http session. Since Wicket Session is an
> attribute in the http session it will be removed as well.
>
> On Wed, Mar 7, 2012 at 6:35 PM, Martin A <wm...@gmail.com> wrote:
> > Hello,
> > I've got a REST service which is behind a Wicket Session Filter (due to
> the
> > need to obtain the wicket current session at the service), and this REST
> > service is being periodically hit by a Flash client (embedded in wicket
> > page)
> > At this REST service I've got a method that retrieves the wicket session,
> > and it holds this snippet of code:
> >
> >    if (session.hasExpired()) {
> >      session.invalidateNow();
> >      throw new SessionExpiredException();
> >    }
> >
> > The reason I do this and rely not on wicket's session timeout is because
> > Wicket will create a new session if previous one is expired, so it'll
> lack
> > all data I've stored in the session.
> >
> > The problem is that, this piece of code being called by the client via
> the
> > REST service throws NullPointerException at Session line 492, which means
> > that current RequestCycle is null. This happens due to calling
> > invalidateNow(). I'm using wicket 1.5.0.
> >
> > Would you please tell me how to invalidate the session immediately in
> this
> > case?
> >
> > Best regards,
> > Martin
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: NullPointerException at Session line 492 - current RequestCycle is null

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

You can invalidate the http session. Since Wicket Session is an
attribute in the http session it will be removed as well.

On Wed, Mar 7, 2012 at 6:35 PM, Martin A <wm...@gmail.com> wrote:
> Hello,
> I've got a REST service which is behind a Wicket Session Filter (due to the
> need to obtain the wicket current session at the service), and this REST
> service is being periodically hit by a Flash client (embedded in wicket
> page)
> At this REST service I've got a method that retrieves the wicket session,
> and it holds this snippet of code:
>
>    if (session.hasExpired()) {
>      session.invalidateNow();
>      throw new SessionExpiredException();
>    }
>
> The reason I do this and rely not on wicket's session timeout is because
> Wicket will create a new session if previous one is expired, so it'll lack
> all data I've stored in the session.
>
> The problem is that, this piece of code being called by the client via the
> REST service throws NullPointerException at Session line 492, which means
> that current RequestCycle is null. This happens due to calling
> invalidateNow(). I'm using wicket 1.5.0.
>
> Would you please tell me how to invalidate the session immediately in this
> case?
>
> Best regards,
> Martin



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

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org