Hi,

org.apache.wicket.NonResettingRestartException does lead to HTTP redirect.
It just restarts the processing of the current request at the server side.
That is after throwing this exception you should not expect that the cookie
has been delivered to the browser. There is no interaction with the browser
at all.

In contrast to RestartResponseException it preserves any cookies (and some
other headers) in the buffering web response.




On Fri, Apr 5, 2013 at 9:49 PM, divad91 <diva...@hotmail.com> wrote:

> I just created a new wicket 6.6.0 quickstart project
> (http://wicket.apache.org/start/quickstart.html)
> and I have the same problem.
>
> If I add the following code in the HomePage class,
>
> Cookie requestCookie = ((WebRequest) getRequest()).getCookie("appCoookie");
> System.out.println("----------------------->" + (requestCookie != null));
>
> Cookie appCookie = new Cookie("appCoookie", "1");
> appCookie.setMaxAge(3600 * 5);
> appCookie.setPath("/");
> appCookie.setSecure(false);
>
> ((WebResponse) getResponse()).addCookie(appCookie);
> if (getSession().getAttribute("init") == null) {
>     getSession().setAttribute("init", "true");
>    System.out.println("here...");
>    throw new NonResettingRestartException(HomePage.class);
> }
>
> the second time I enter the HomePage constructor, the cookie is not present
> in the request.
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Browser-Cookie-detection-tp4657744p4657789.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


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

Reply via email to