Hi Martin,

I'm fine for this. My cookie code actually works. (But if the user's browser
disables cookies, then I want to use HTTP headers to be able to say "The
user is on his/her second page, and still no cookie, so cookies are
definitely disabled (I cannot tell this on the first page).")

Many thanks for your tip about FireBug! Grand. (I had never thought about

All my web pages are descended from my PageBase class, which in turn
descends from Wicket's WebPage. I set my HTTP header in code in my PageBase
constructor using


In the first call to the app (which shows the home page), I can see this
header in the response headers using FireBug under "GET PageHome?0". Sadly,
I cannot detect this in my PageBase constructor using

  import org.apache.wicket.request.cycle.RequestCycle;
  import org.apache.wicket.request.http.WebRequest;

  RequestCycle rcRequestCycle = getRequestCycle();
  WebRequest wreqRequest = (WebRequest)rcRequestCycle.getRequest();
  String sHeaderValue = wreqRequest.getHeader("X-MyApp-NotFirstPageBase-1");

since I get sHeaderValue to be null. Also, I cannot see this header in the
request headers using FireBug.

After clicking the link on my home page to the "About us" page, I can see
this header in the response headers using FireBug under "GET PageAbout?1",
but nowhere else (including request headers even though I believe that I add
this to each web request unconditionally).

If I add


to my PageHome's form's onSubmit() method, then after form submission I do
see this header, but in the response only in

  POST page?1-1.IFormSubmitListener-frmForm



(I am running locally).

Am I looking in the wrong place in my code (and thus in the request cycle)
to find my header in a request?

Martin Grigorov-4 wrote
> Hi Ian,
> If you add/set a header in the HttpServletResponse (even thru Wicket's
> WebResponse) then it will be written to the browser. You can verify
> that by investigating the request in Firebug's Net panel.
> If you want to send a cookie you should either use #addCookie() or
> set/addHeader("Set-Cookie"). Check in google for more info.
> So you set the cookie in the current response and if not expired it
> should be available in the next *request* (HttpServletRequest or
> Wicket's WebRequest).

View this message in context: 
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

Reply via email to