RequestUtils.toAbsolutePath is very problematic in AJAX
-------------------------------------------------------

                 Key: WICKET-2632
                 URL: https://issues.apache.org/jira/browse/WICKET-2632
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.4.5
         Environment: Linux , Resin 3.1.9  , JDK 1.6.0_17
            Reporter: smallufo


This bug is similar to WICKET-2312 
https://issues.apache.org/jira/browse/WICKET-2312
WICKET-2312 is about link  , and this bug is about Button

The whole WicketServlet is mapped by <url-pattern>/app/*</url-pattern>

The code is simple :
HTML :

<form wicket:id="form">
  <input type="button" wicket:id="button" value="click me"/>
</form>

Java Code : CurrentPage.java (it is mounted to '/CurrentPage'  )

String a1 = 
RequestUtils.toAbsolutePath(getRequestCycle().urlFor(CurrentPage.class , 
pps).toString());
System.out.println("outer = " + a1);

Form form = new Form("form");
add(form);

Button button = new AjaxButton("button")
{
  @Override
  protected void onSubmit(AjaxRequestTarget target, Form<?> form)
  {
    String a2 = 
RequestUtils.toAbsolutePath(getRequestCycle().urlFor(CurrentPage.class , 
pps).toString());
    System.out.println("inner = " + a2);
  }
};
form.add(button);

When browsing 
http://foobar.com:8080/quickstart/app/CurrentPage
Everything is fine :
outer = http://foobar.com:8080/quickstart/app/CurrentPage
inner = http://foobar.com:8080/quickstart/app/CurrentPage

But if I browse 
http://foobar.com:8080/quickstart/app/CurrentPage/
With trailing slash ,  it goes wrong :

outer = http://foobar.com:8080/quickstart/app/CurrentPage
inner = http://foobar.com:8080/quickstart/CurrentPage

The "app" (WicketServlet's url-pattern) is gone ... , and the trailing slash is 
gone, too.

And more ... if I further browse 
http://foobar.com:8080/quickstart/app/CurrentPage/key/value
The problem goes more severe :
outer = http://foobar.com:8080/quickstart/app/CurrentPage/key/value
inner = http://foobar.com:8080/CurrentPage/key/value

web-app's context (quickstart) , and WicketServlet's url-pattern are both gone 
!!!


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to