Re: Cookies and RestartResponseException

2012-12-26 Thread Alexandros Karypidis

So simple...

I spent the last 8 minutes (i.e. till I received your reply) playing 
with a custom PageProvider, trying to set the cookie in 
getPageInstance(), (only to find that it doesn't matter since the 3xx 
redirect ends up retrieving the page from the default page provider anyway).


Thx!

On 26/12/12 18:19, Sven Meier wrote:

Use NonResettingRestartException

Sven

On 12/26/2012 07:11 PM, Alexandros Karypidis wrote:

Hi,

I am using CookieUtils to store a cookie. Here's the catch though: 
after setting the cookie, I want to redirect the user to a new page, 
so that is followed immediately by a RestartResponseException:


new CookieUtils().save("some-key", "some-value")
throw new RestartResponseException(AnotherPage.class);

The net result seems to be that Wicket uses an HTTP 3xx to get the 
user agent to go to the new page (which is what I want, since the URL 
changes), but the cookie does NOT get set.


If instead of RestartResponseException the I use:

RequestCycle.get().setResponsePage(AnotherPage.class);

...the cookie gets set properly and the redirect occurs as desired, 
but I need to perform the redirect in "library code", which should 
prevent the calling thread from proceeding beyond the redirect point 
(which RestartResponseException nicely addresses).


Is there some way to use RestartResponseException without discarding 
cookies?


Cheers,
Alex



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




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



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



Re: Cookies and RestartResponseException

2012-12-26 Thread Sven Meier

Use NonResettingRestartException

Sven

On 12/26/2012 07:11 PM, Alexandros Karypidis wrote:

Hi,

I am using CookieUtils to store a cookie. Here's the catch though: 
after setting the cookie, I want to redirect the user to a new page, 
so that is followed immediately by a RestartResponseException:


new CookieUtils().save("some-key", "some-value")
throw new RestartResponseException(AnotherPage.class);

The net result seems to be that Wicket uses an HTTP 3xx to get the 
user agent to go to the new page (which is what I want, since the URL 
changes), but the cookie does NOT get set.


If instead of RestartResponseException the I use:

RequestCycle.get().setResponsePage(AnotherPage.class);

...the cookie gets set properly and the redirect occurs as desired, 
but I need to perform the redirect in "library code", which should 
prevent the calling thread from proceeding beyond the redirect point 
(which RestartResponseException nicely addresses).


Is there some way to use RestartResponseException without discarding 
cookies?


Cheers,
Alex



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




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