I had the same issue. Do you have any estimate on the release date of RC2?

Zhubin

-----Original Message-----
From: Igor Vaynberg [mailto:[email protected]] 
Sent: February 10, 2011 1:54 PM
To: [email protected]
Subject: Re: Wicket 1.5 and custom request cycle

i just fixed this last night, will be part of rc2.

-igor

On Thu, Feb 10, 2011 at 10:46 AM, Bertrand Guay-Paquet
<[email protected]> wrote:
> Hello,
>
> Disclaimer: I am a relatively new Wicket user
>
> I use a custom session to store the current user Id and I want to use the
> request cycle to store the current user object which is fetched from the DB
> on each request following advice from
> http://wicket-users.markmail.org/search/?q=cart+thread+safe#query:cart%20thread%20safe+page:1+mid:m3kgdjxv2fmeebvt+state:results
> and
> http://wicket-users.markmail.org/search/?q=session+thread+safe#query:session%20thread%20safe+page:1+mid:oh4v4ivhubc3ao4s+state:results
>
> To this end, I followed the instructions from
> https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-RequestCycle
> However, the method WebApplication#addRequestCycleListener() does not exist.
> I searched for a replacement but only found
> Application#getRequestCycleListeners() which gives access to the listener
> list. Its Javadoc however states that the returned list is unmodifiable so I
> avoided this route.
>
> So instead I used Application#setRequestCycleProvider() to create my
> CustomRequestCycle class. This class has the following method:
> @Override
> protected void onBeginRequest() {
>    super.onBeginRequest();
>    Long userId = (CustomSession)Session.get().getCurrentUserId();
>    if (userId != null)
>        // fetch user...
> }
>
> My problem is that I get a NullPointerException in Session#get(). When first
> accessing a page, there is no session associated with the TheadContext. So
> the following line is then executed in Session#get():
> Application.get().fetchCreateAndSetSession(RequestCycle.get())
>
> RequestCycle.get() returns null because ThreadContext.requestCycle has not
> been set yet when onBeginRequest() is called.
>
> I am doing something wrong? Is this a bug?
>
> Thanks!
>
> ---------------------------------------------------------------------
> 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]


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

Reply via email to