I am having trouble with JSessionIDs in my URLs (my post at


refers). So my plan is to detect the case where a web browser has disabled
(session) cookies and react accordingly (for example: show a page to ask for
cookie enablement). I plan to detect cookie disablement by writing a cookie
during each client request from my common page PageBase (almost all of my
web pages are sub-classed from PageBase, which in turn is sub-classed from
org.apache.wicket.markup.html.WebPage). If any server response after the
first does not have this cookie then I know that cookies are disabled. But
how to know that a client request is not the first?

I want to explore adding/setting an HTML header to each server response. I
can use this to know whether or not this is the client's first request.

In my application class, which is a sub-class of
org.apache.wicket.protocol.http.WebApplication, I override
newWebResponse(...) like this:

    protected WebResponse newWebResponse(final WebRequest webRequest,
     final HttpServletResponse httpServletResponse)
      httpServletResponse.addHeader("X-MyApp-NotFirstPageBase-1", "true");
      httpServletResponse.setHeader("X-MyApp-NotFirstPageBase-2", "true");

      return super.newWebResponse(webRequest, httpServletResponse);

No such headers appear in the browser's page source. I tried the following
code in my "About us" page.

    public PageAbout()

      Form frmForm = new Form("frmForm")
        private static final long serialVersionUID = 1L;

        protected void onSubmit()

          WebResponse wrResponse = (WebResponse)getResponse();
          wrResponse.addHeader("X-MyApp-NotFirstPageBase-1", "true");
          wrResponse.setHeader("X-MyApp-NotFirstPageBase-2", "true");


Again no such header appeared.

Can anyone see what I am doing wrong?


Ian Marshall

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