You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Bilgin Ibryam <bi...@gmail.com> on 2010/06/28 14:21:05 UTC

Reading cookies on first/each request

Hi all,

I want to implement "Remember me" functionality  by storing the encrypted
and base64 encoded username in a cookie.
Then I'd like to check for the cookie on the very first request (or every
request) to the application.

Any tips whats the best way to access httpRequest object on each request to
the application? I suppose it has to do something with RequestCycle object,
but not sure.


Thanks in advance
Bilgin Ibryam

Re: Reading cookies on first/each request

Posted by Bilgin Ibryam <bi...@gmail.com>.
Thanks guys. This will solve my problem.

Bilgin

On Tue, Jun 29, 2010 at 6:10 AM, Igor Vaynberg <ig...@gmail.com>wrote:

> alternatively requestcycle#onbeginrequest() is also a good place
>
> -igor
>
> On Mon, Jun 28, 2010 at 7:05 AM, M. Hammer <na...@hammer-tour.com> wrote:
> > Quoting Bilgin Ibryam <bi...@gmail.com>:
> >>
> >> I want to implement "Remember me" functionality  by storing the
> encrypted
> >> and base64 encoded username in a cookie.
> >> Then I'd like to check for the cookie on the very first request (or
> every
> >> request) to the application.
> >
> > Hi,
> >
> > I do this in the newSession() method of my Application subclass. This
> method
> > is called for the first request of a user, and possible for subsequent
> > requests if the requested page is stateless. If a cookie is found, I copy
> > the contents to the user's session and use it from there.
> > You have to cast Request and Response to WebRequest and WebResponse, and
> you
> > can use getCookie() and addCookie(), respectively.
> >
> > Regards,
> >  Moritz
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Reading cookies on first/each request

Posted by Igor Vaynberg <ig...@gmail.com>.
alternatively requestcycle#onbeginrequest() is also a good place

-igor

On Mon, Jun 28, 2010 at 7:05 AM, M. Hammer <na...@hammer-tour.com> wrote:
> Quoting Bilgin Ibryam <bi...@gmail.com>:
>>
>> I want to implement "Remember me" functionality  by storing the encrypted
>> and base64 encoded username in a cookie.
>> Then I'd like to check for the cookie on the very first request (or every
>> request) to the application.
>
> Hi,
>
> I do this in the newSession() method of my Application subclass. This method
> is called for the first request of a user, and possible for subsequent
> requests if the requested page is stateless. If a cookie is found, I copy
> the contents to the user's session and use it from there.
> You have to cast Request and Response to WebRequest and WebResponse, and you
> can use getCookie() and addCookie(), respectively.
>
> Regards,
>  Moritz
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Reading cookies on first/each request

Posted by "M. Hammer" <na...@hammer-tour.com>.
Quoting Bilgin Ibryam <bi...@gmail.com>:
> I want to implement "Remember me" functionality  by storing the encrypted
> and base64 encoded username in a cookie.
> Then I'd like to check for the cookie on the very first request (or every
> request) to the application.
Hi,

I do this in the newSession() method of my Application subclass. This  
method is called for the first request of a user, and possible for  
subsequent requests if the requested page is stateless. If a cookie is  
found, I copy the contents to the user's session and use it from there.
You have to cast Request and Response to WebRequest and WebResponse,  
and you can use getCookie() and addCookie(), respectively.

Regards,
   Moritz


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