You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Tauren Mills <ta...@tauren.com> on 2009/05/21 13:04:16 UTC

Problem with redirectToInterceptPage in AjaxLink with IndexedParamUrlCodingStrategy in Jetty

On a page that is mounted with an IndexedParamUrlCodingStrategy, I have an
AjaxFallbackLink. If the user is not logged in, it's onclick issues a
redirectToInterceptPage to my Login page. Once the user is logged in, my
understanding is that the user should go back to the page that contains the
ajax  link.  However, when I am not logged in, click the ajax link, and log
in, I'm getting an exception and shown a blank page with the following URL,
which I believe is the path to my Login form submit button:
http://localhost:8080/?wicket:interface=:2:body:tabs:panel:signInForm::IFormSubmitListener
::

The URL of the page that contains the ajax link is actually:
http://localhost:8080/forums/5/test-thread-c/

So when I trace through the code in PageMap.java during the call to
redirectInterceptPage(), the value of interceptContinuationURL is set the
following.  This is the path used in the redirect after login:
../../../?wicket:interface=:0::::

It gets this from the call to
cycle.urlFor(cycle.getRequest().getPage()).toString():

        // The intercept continuation URL should be saved exactly as the
        // original request specified.
        // Only if it is an ajax request just redirect to the page where the
request is from.
        if (cycle.getRequest() instanceof WebRequest &&
((WebRequest)cycle.getRequest()).isAjax())
        {
            interceptContinuationURL =
cycle.urlFor(cycle.getRequest().getPage()).toString();
        }
        else
        {
            interceptContinuationURL = "/" + cycle.getRequest().getURL();
        }

When I get the exception, the value of location is set to null in Jetty's
Response.sendRedirect():
        location=URIUtil.canonicalPath(URIUtil.addPaths(parent,location));
        if(location==null)
            throw new IllegalStateException("path cannot be above root");

Here is the exception I'm getting:

java.lang.IllegalStateException: path cannot be above root
    at org.mortbay.jetty.Response.sendRedirect(Response.java:399)
    at
org.apache.wicket.protocol.http.WebResponse.redirect(WebResponse.java:232)

According to the URIUtil.canonicalPath javadoc:
    /** Convert a path to a cananonical form.
     * All instances of "." and ".." are factored out.  Null is returned
     * if the path tries to .. above its root.
     * @param path
     * @return path or null.
     */

So, I realize this could be a Jetty issue, but I'm using the latest
(6.1.16). I haven't had any other problems with Jetty before. It seems that
the path being returned by Wicket has too many /.. strings in it.  Is it
possible this is a wicket issue? BTW, I'm using Wicket 1.3.6.

Any insights would be appreciated!

Thanks,
Tauren