Re: [Bug 1.3.6] Inconsistent RequestUtils.toAbsolutePath()
I've attached a quickstart code , including error case , to WICKET-2312 https://issues.apache.org/jira/browse/WICKET-2312 I think the problem may come from bookmarkablePage parsing parameters... The CurrentPage is mounted to /CurrentPage by mountBookmarkablePage(/CurrentPage , CurrentPage.class); Test steps : Step 1: user browser to link to http://foo.bar:8080/quickstart/app/CurrentPage outer = http://foo.bar:8080/quickstart/app/CurrentPage inner = http://foo.bar:8080/quickstart/app/CurrentPage both are correct. But ... Step 2: Open browser to connect to : http://foo.bar:8080/quickstart/app/CurrentPage/key/value outer = http://foo.bar:8080/quickstart/app/CurrentPage/key/value/ inner = http://foo.bar:8080/CurrentPage/key/value/ outer is correct , but inner is wrong ! inner lacks of context(quickstart) and path(app) here.
Re: [Bug 1.3.6] Inconsistent RequestUtils.toAbsolutePath()
2009/6/7 Johan Compagner jcompag...@gmail.com can you debug and see what this returns for both situations? ((WebRequest)RequestCycle.*get*().getRequest()).getHttpServletRequest() .getRequestURL().toString() ok , here is my test : String a1 = ((WebRequest)RequestCycle.get().getRequest()).getHttpServletRequest().getRequestURL().toString(); System.out.println(a1 = + a1); String s1 = RequestUtils.toAbsolutePath(getRequestCycle().urlFor(CurrentPage.class , pps).toString()); System.out.println(s1 = + s1); Link link = new AjaxFallbackLink(link) { @Override public void onClick(AjaxRequestTarget target) { String a2 = ((WebRequest)RequestCycle.get().getRequest()).getHttpServletRequest().getRequestURL().toString(); System.out.println(a2 = + a2); final String s2 = RequestUtils.toAbsolutePath(getRequestCycle().urlFor(CurrentPage.class , pps).toString()); System.out.println(s2 = + s2); } }; a1 = http://foo.bar:8080/app/CurrentPage s1 = http://foo.bar:8080/app/CurrentPage a2 = http://foo.bar:8080/app/ s2 = http://CurrentPage/ a1 , s1 are correct , a2 , s2 are totally wrong.
Re: [Bug 1.3.6] Inconsistent RequestUtils.toAbsolutePath()
a1 = http://foo.bar:8080/app/CurrentPage s1 = http://foo.bar:8080/app/CurrentPage a2 = http://foo.bar:8080/app/ s2 = http://CurrentPage/ http://currentpage/ a1 , s1 are correct , a2 , s2 are totally wrong. a1 , s1 en a2 are all correct. but why s2 is a result when a2 is the input for that toAbsolutePath is weird. Because quickly looking at the code it should just doe a2 + relativePath to the CurrentPage == s1... Jus debug it once and go into that method * final * StringBuffer result; *if* (requestPath.endsWith(/)) { result = *new* StringBuffer(requestPath); } *else* { // Remove everything after last slash (but not slash itself) result = *new* StringBuffer(requestPath.substring(0, requestPath.lastIndexOf('/') + 1)); } thats the code and a1 goes into the else and a2 goes into the if.. But why would that result in s2.
Re: [Bug 1.3.6] Inconsistent RequestUtils.toAbsolutePath()
No it is just the request uri and the request uri of the ajax call will always be http://foo.bar:8080/app/?xx=y so that is correct. And looking at the code you also can see that that last piece CurrentPage is stripped out (as it should) in the make to absolute path code Just Debug it On Sun, Jun 7, 2009 at 19:03, smallufo small...@funp.com wrote: 2009/6/7 Johan Compagner jcompag...@gmail.com a1 = http://foo.bar:8080/app/CurrentPage s1 = http://foo.bar:8080/app/CurrentPage a2 = http://foo.bar:8080/app/ s2 = http://CurrentPage/ http://currentpage/ http://currentpage/ a1 , s1 are correct , a2 , s2 are totally wrong. a1 , s1 en a2 are all correct. but why s2 is a result when a2 is the input for that toAbsolutePath is weird. Why a2 is correct ? I think a2 should be identical to a1 (and s1) ...
Re: [Bug 1.3.6] Inconsistent RequestUtils.toAbsolutePath()
The problem is that when you have a bookmarkable page with parameters, the url looks like this: http://www.mydomain.com/myapp/MyPage/param1/value1/param2/value2 The parameters are not part of the url path, but the toAbsolutePath code assumes them to be. It would be better if it would adapt to the used url encoding and strip page parameters. ** Martin 2009/6/7 Johan Compagner jcompag...@gmail.com: No it is just the request uri and the request uri of the ajax call will always be http://foo.bar:8080/app/?xx=y so that is correct. And looking at the code you also can see that that last piece CurrentPage is stripped out (as it should) in the make to absolute path code Just Debug it On Sun, Jun 7, 2009 at 19:03, smallufo small...@funp.com wrote: 2009/6/7 Johan Compagner jcompag...@gmail.com a1 = http://foo.bar:8080/app/CurrentPage s1 = http://foo.bar:8080/app/CurrentPage a2 = http://foo.bar:8080/app/ s2 = http://CurrentPage/ http://currentpage/ http://currentpage/ a1 , s1 are correct , a2 , s2 are totally wrong. a1 , s1 en a2 are all correct. but why s2 is a result when a2 is the input for that toAbsolutePath is weird. Why a2 is correct ? I think a2 should be identical to a1 (and s1) ... - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [Bug 1.3.6] Inconsistent RequestUtils.toAbsolutePath()
that it doesnt give you the hostname/port is ofcourse a bug print out these variables: getRequestCycle().urlFor(CurrentPage.class ,pps).toString() I think that one time it will give you just the url and one time ../.././CurrentPage i guess that is your problem but you need to debug a bit more why it gives you that ../../ On Sun, Jun 7, 2009 at 20:14, smallufo small...@funp.com wrote: Is there a plan to make behavior of RequestUtils.toAbsolutePath (inside/outside AJAX) identical ? If no , the only way to get the correct absolute URL in the AJAX onClick() is pre-appending host name / port / context name ... I think it is so cumbersome 2009/6/8 Martin Makundi martin.maku...@koodaripalvelut.com The problem is that when you have a bookmarkable page with parameters, the url looks like this: http://www.mydomain.com/myapp/MyPage/param1/value1/param2/value2 The parameters are not part of the url path, but the toAbsolutePath code assumes them to be. It would be better if it would adapt to the used url encoding and strip page parameters. ** Martin
Re: [Bug 1.3.6] Inconsistent RequestUtils.toAbsolutePath()
please attach a failing test case On Sun, Jun 7, 2009 at 21:16, smallufo small...@funp.com wrote: 2009/6/8 Johan Compagner jcompag...@gmail.com that it doesnt give you the hostname/port is ofcourse a bug I've submitted this bug to JIRA : https://issues.apache.org/jira/browse/WICKET-2312
Re: [Bug 1.3.6] Inconsistent RequestUtils.toAbsolutePath()
I don't know if this is related to WICKET-1599 : https://issues.apache.org/jira/browse/WICKET-1599 2009/6/7 smallufo small...@gmail.com This is my code : String s1 = RequestUtils.toAbsolutePath(getRequestCycle().urlFor(CurrentPage.class , pps).toString()); System.out.println(s1 = + s1); Link link = new AjaxFallbackLink(link) { @Override public void onClick(AjaxRequestTarget target) { final String s2 = RequestUtils.toAbsolutePath(getRequestCycle().urlFor(CurrentPage.class , pps).toString()); System.out.println(s2 = + s2); } }; This is the result : s1 = http://foo.bar:8080/app/CurrentPage s2 = CurrentPage/foo/bar/para/meters String s1 is what I need , it has http://foo.bar:8080/app/; in the head of the string. But why s2 don't have host and context name (app) in the head ? It is inconsistent Is it possible to make it consistent with s1 ?
Re: [Bug 1.3.6] Inconsistent RequestUtils.toAbsolutePath()
can you debug and see what this returns for both situations? ((WebRequest)RequestCycle.*get*().getRequest()).getHttpServletRequest() .getRequestURL().toString() On Sat, Jun 6, 2009 at 21:49, smallufo small...@gmail.com wrote: This is my code : String s1 = RequestUtils.toAbsolutePath(getRequestCycle().urlFor(CurrentPage.class , pps).toString()); System.out.println(s1 = + s1); Link link = new AjaxFallbackLink(link) { @Override public void onClick(AjaxRequestTarget target) { final String s2 = RequestUtils.toAbsolutePath(getRequestCycle().urlFor(CurrentPage.class , pps).toString()); System.out.println(s2 = + s2); } }; This is the result : s1 = http://foo.bar:8080/app/CurrentPage s2 http://foo.bar:8080/app/CurrentPages2 = CurrentPage/foo/bar/para/meters String s1 is what I need , it has http://foo.bar:8080/app/; in the head of the string. But why s2 don't have host and context name (app) in the head ? It is inconsistent Is it possible to make it consistent with s1 ?