Wicket-Ajax-BaseURL encoding problem when uploading file using ajax

2014-11-07 Thread Daniel Stoch
Hi,

I have a strange error when uploading file using ajax request. I have
a page with parameters whit url like:
http://localhost:8080/myapp/customer/id/1234

When I am opening a modal window with upload form the Wicket-Ajax-BaseURL is:
  customer/id/1234?1
and all links in ajax response are properly constructed, eg.:
  
../../wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-event-jquery-ver-140930656.js

But when I choose a file and press upload (using AjaxSubmitButton)
then in the followed request Wicket-Ajax-BaseURL is encoded like:
  customer%2Fid%2F1234
so the code inside UrlRenderer.renderRelativeUrl does not find a
proper baseUrlSegments so the calculated renderedUrl is wrong. This
leads to invalid url paths, eg.:
  
./wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-event-jquery-ver-140930656.js
and other errors with resolving urls.

I cannot find where this base url can be broken? Maybe the problem is
somewhere in my code, but I don't know where to search for this.

PS. The same error is in FF and Chrome. Wicket 6.17.0.

--
Best regards,
Daniel

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket-Ajax-BaseURL encoding problem when uploading file using ajax

2014-11-07 Thread Daniel Stoch
I think the problem is in POST request when submitting a form. In
wicket-ajax-jquery.js wicket-ajax-baseurl parametr is appended to
request url. It is encoded using Wicket.Form.encode:
  form.action = attrs.u + separator +
wicket-ajax=truewicket-ajax-baseurl= +
Wicket.Form.encode(getAjaxBaseUrl());

After this an url becomes encoded using escaped %2F instead of slashes
(eg. customer%2Fid%2F1234).
This leads to resolving urls problems, as I have described in my previous post.

--
Best regards,
Daniel

On Fri, Nov 7, 2014 at 1:30 PM, Daniel Stoch daniel.st...@gmail.com wrote:
 Hi,

 I have a strange error when uploading file using ajax request. I have
 a page with parameters whit url like:
 http://localhost:8080/myapp/customer/id/1234

 When I am opening a modal window with upload form the Wicket-Ajax-BaseURL is:
   customer/id/1234?1
 and all links in ajax response are properly constructed, eg.:
   
 ../../wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-event-jquery-ver-140930656.js

 But when I choose a file and press upload (using AjaxSubmitButton)
 then in the followed request Wicket-Ajax-BaseURL is encoded like:
   customer%2Fid%2F1234
 so the code inside UrlRenderer.renderRelativeUrl does not find a
 proper baseUrlSegments so the calculated renderedUrl is wrong. This
 leads to invalid url paths, eg.:
   
 ./wicket/resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-event-jquery-ver-140930656.js
 and other errors with resolving urls.

 I cannot find where this base url can be broken? Maybe the problem is
 somewhere in my code, but I don't know where to search for this.

 PS. The same error is in FF and Chrome. Wicket 6.17.0.

 --
 Best regards,
 Daniel

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org