Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-3258

Allow for non-relative redirects for buggy servlet containers



    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.4.14, 1.5-M3
    • 1.4.18, 1.5.0
    • wicket
    • None
    • Websphere


      There appears to be a bug in the way WebSphere handles relative URLs. The servlet spec (http://jcp.org/aboutJava/communityprocess/final/jsr154/index.html), page 260 specifies the behavior for relative URLs, which Wicket uses, but WebSphere appears to ignore. If we send a relative URL like "../../Something.html" to HttpServletResponse#sendRedirect, the relative path should be relative to the requested URI (the page I was requesting that resulted in the redirect). WebSphere isn't implementing this behavior correctly. Instead, it appears to interpret it as relative to the app context and servlet mapping.

      More details:

      We request a page like:

      That page results in an error, and Wicket tries to redirect to an unmounted bookmarkable page by doing sendRedirect("../../?wicket:bookmarkablePage=:com.FooPage"). This is correct according to the servlet spec, because the url passed to sendRedirect should be relative to the requested URI (<--- this is the key). So, we expect the container to redirect to http://[server]:[serverport]/[appcontext]/[servletmapping]/?wicket:bookmarkable=com.FooPage . Jetty does (and Tomcat and others). But, WebSphere does not.

      Although I cannot look at the Websphere code, I suspect that it is interpreting this relative URL as being relative to the root of the servlet mapping. It is then removing two folders, which takes us back to the server root (instead of the servlet mapping, like it should), removing the app context and servlet mapping (i.e. http://[server]:[serverport]/?wicket:bookmarkable=com.FooPage) This is obviously incorrect.

      We have tried this compatibility setting (true and false), but it didn't work: https://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/xrun_jvm_sendredirect.html

      There are a lot of reports about the problem:

      Although we obviously can't fix the issue, we should provide a way for users of these servlet containers to redirect to an absolute URL rather than a relative URL.


        1. relativeurlproblem.tar.gz
          5 kB
          Jeremy Thomerson



            jthomerson Jeremy Thomerson
            jthomerson Jeremy Thomerson
            0 Vote for this issue
            3 Start watching this issue