You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by smallufo <sm...@gmail.com> on 2008/05/06 21:16:53 UTC

RequestUtils.toAbsolutePath()'s bug ?

Environment : Wicket 1.3.3

Suppose the following code in a bookmarkable page , say "FirstPage" :

When user pushes an AJAX button , the page builds a bookmarkable link :

Map<String , Object> parameterMap = new HashMap<String , Object>();
parameterMap.put("index" , myObj.getIndex());
PageParameters pps = new PageParameters(parameterMap);
String absUrl =
RequestUtils.toAbsolutePath(getRequestCycle().urlFor(SecondPage.class ,
pps).toString());

If the user navigates properly (by clicking links to the FirstPage) ,
the absUrl is correct : foobar/SecondPage/index/1/
after pre-adding "http://" + req.getServerName() + contextPath + "/" , I can
correctly build the (bookmarkable) link like this :
http://www.foobar.com/app/foobar/SecondPage/index/1


BUT , if the user directly links to the FirstPage(copy / paste the
FirstPage's url in the browser's url bar) ,
or clicks the SecondPage's link and back (by browser) , and pushes the AJAX
button again...
SOMETIMES , absUrl becomes :
http://foobar/SecondPage/index/1/ , the preceding "http://" is redundant !!!
And , my bookmarkable link becomes :
http://www.foobar.com/app/http://foobar/SecondPage/index/1

I can not successfully re-produce this error every time. but sometimes it
just occurs .
It seems it is a bug...

PS : I know how to build a BookmarkablePageLink in the wicket way , But I
have to do this for a special purpose.....

Re: RequestUtils.toAbsolutePath()'s bug ?

Posted by smallufo <sm...@funp.com>.
I don't know if this is related to WICKET-1599 :

https://issues.apache.org/jira/browse/WICKET-1599



2008/5/7 smallufo <sm...@gmail.com>

> Environment : Wicket 1.3.3
>
> Suppose the following code in a bookmarkable page , say "FirstPage" :
>
> When user pushes an AJAX button , the page builds a bookmarkable link :
>
> Map<String , Object> parameterMap = new HashMap<String , Object>();
> parameterMap.put("index" , myObj.getIndex());
> PageParameters pps = new PageParameters(parameterMap);
> String absUrl =
> RequestUtils.toAbsolutePath(getRequestCycle().urlFor(SecondPage.class ,
> pps).toString());
>
> If the user navigates properly (by clicking links to the FirstPage) ,
> the absUrl is correct : foobar/SecondPage/index/1/
> after pre-adding "http://" + req.getServerName() + contextPath + "/" , I
> can correctly build the (bookmarkable) link like this :
> http://www.foobar.com/app/foobar/SecondPage/index/1
>
>
> BUT , if the user directly links to the FirstPage(copy / paste the
> FirstPage's url in the browser's url bar) ,
> or clicks the SecondPage's link and back (by browser) , and pushes the AJAX
> button again...
> SOMETIMES , absUrl becomes :
> http://foobar/SecondPage/index/1/ , the preceding "http://" is redundant
> !!!
> And , my bookmarkable link becomes :
> http://www.foobar.com/app/http://foobar/SecondPage/index/1
>
> I can not successfully re-produce this error every time. but sometimes it
> just occurs .
> It seems it is a bug...
>
> PS : I know how to build a BookmarkablePageLink in the wicket way , But I
> have to do this for a special purpose.....
>
>