You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Jean-Baptiste Quenot <jb...@apache.org> on 2007/05/14 21:23:11 UTC

Re: svn commit: r537771 - in /incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http: WebRequestCycle.java servlet/ServletWebRequest.java

* jcompagner@apache.org:
> Author: jcompagner
> Date: Mon May 14 03:28:40 2007
> New Revision: 537771
> 
> URL: http://svn.apache.org/viewvc?view=rev&rev=537771
> Log:
> relative urls for a bookmarkable request that will do a redirect to a wicket page fix.
> 
> Modified:
>     incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java
>     incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java
> 
> Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java
>
> @@ -138,6 +139,13 @@
>  			final WebResponse currentResponse = getWebResponse();
>  			try
>  			{
> +				redirectUrl = page.urlFor(IRedirectListener.INTERFACE).toString();
> +				if (getWebRequest() instanceof ServletWebRequest)
> +				{
> +					// Get the redirect url and set it in the ServletWebRequest
> +					// so that it can be used for relative url calculation.
> +					((ServletWebRequest)getWebRequest()).setWicketRedirectUrl(redirectUrl.replaceAll("../", ""));	
> +				}

That's sounds very hacky to me:

        redirectUrl.replaceAll("../", "")

Can you describe the problem so that we try to provide a better
fix (and hopefully AlMaw is listening to us ;-))

Cheers,
-- 
     Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/

Re: svn commit: r537771 - in /incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http: WebRequestCycle.java servlet/ServletWebRequest.java

Posted by Johan Compagner <jc...@gmail.com>.
AlMaw and i  already talked and discussed about this.
and this is currently the way that we did see.

we could do it maybe a bit better by only looking at the beginning
or have a special urlFor method that doesn't do the relative path
prepending..

I already described the problem a few days ago (i think late last week on
the dev list)
it was really a major problem for me because if i get a mount request
(bookmarkable url thats mounted)
then i always do a redirect to the page so /mout/mout2/mount3 would become
/?wicket:interface=xxxx

But in the redirect to buffer the page is rendered with the mount. So all
the urls that are in the resulting page
had ../../../ (the 3 mounts) and then ?wicket:interface or /resources

that is ofcourse really wrong because ../../../ is just the complete root
because the resulting url isn't the mount
but a wicket interface that is already a root. So all my pages especially
with ajax didn't work on the first request
(a refresh in the browser and it did work) and i have to do a redirect
because else if i do stuff with ajax on the page
and users then think i want a refrehs and they do that. Then it is just a
bookmarkable mount request again and they
loose there page with all the ajax changes

Maybe if matej finally makes its thingie that we keep the mount but do a
redirect but then with:

/mout/mout2/mount3[pageid:versionid]

then it works (so hybrid urls with mounts)

johan

That's sounds very hacky to me:
>
>         redirectUrl.replaceAll("../", "")
>
> Can you describe the problem so that we try to provide a better
> fix (and hopefully AlMaw is listening to us ;-))
>
> Cheers,
> --
>      Jean-Baptiste Quenot
> aka  John Banana   Qwerty
> http://caraldi.com/jbq/
>

Re: svn commit: r537771 - in /incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http: WebRequestCycle.java servlet/ServletWebRequest.java

Posted by Al Maw <wi...@almaw.com>.
Jean-Baptiste Quenot wrote:
> That's sounds very hacky to me:
> 
>         redirectUrl.replaceAll("../", "")
> 
> Can you describe the problem so that we try to provide a better
> fix (and hopefully AlMaw is listening to us ;-))

Yeah, I think it's hacky too, especially given the rest of this is now 
fairly sane. Rest assured I'm looking into it.

Al