You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Sven Meier (JIRA)" <ji...@apache.org> on 2009/01/08 09:23:59 UTC

[jira] Updated: (WICKET-2007) redirect with umlauts fails

     [ https://issues.apache.org/jira/browse/WICKET-2007?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sven Meier updated WICKET-2007:
-------------------------------

    Description: 
A redirect does not contain encoding information - contentType seems to be ignored by IE and Firefox.
Neither does Wicket encode the URL of a redirect according to IRequestCycle#responseRequestEncoding.
Thus the browser cannot correctly decode umlauts in a redirect's target.

Thus I propose, that WebResponse#redirect(String) should always encode the given URL.

I'm currently using a subclass of WebResponse which utiilizes a tweaked WicketURLEncoder to encode all umlauts:

	public void redirect(String url) {
		url = redirectEncoder.encode(url);

		super.redirect(url);
	}

	// don't encode any delimiter
	private static final WicketURLEncoder redirectEncoder = new WicketURLEncoder(-1) {
		{
			dontNeedEncoding.set(' ');
			dontNeedEncoding.set('/');
			dontNeedEncoding.set('?');
			dontNeedEncoding.set('&');
			dontNeedEncoding.set('=');
			dontNeedEncoding.set('+');
			dontNeedEncoding.set(';');
		}
	};

Note that specifying the URIEncoding on the Tomcat connector does *not* solve the problem.
(http://wiki.apache.org/tomcat/FAQ/Connectors#Q8)

  was:
A redirect does not contain encoding information - contentType seems to be ignored by IE and Firefox.
Neither does Wicket encode the URL of a redirect according to IRequestCycle#responseRequestEncoding.
Thus the browser cannot correctly decode umlauts in a redirect's target.

Thus I propose, that WebResponse#redirect(String) should always encode the given URL.

I'm currently using a subclass of WebResponse which utiilizes a tweaked WicketURLEncoder to encode all umlauts:

	public void redirect(String url) {
		url = redirectEncoder.encode(url);

		super.redirect(url);
	}

	// don't encode any delimiter
	private static final WicketURLEncoder redirectEncoder = new WicketURLEncoder(-1) {
		{
			dontNeedEncoding.set(' ');
			dontNeedEncoding.set('/');
			dontNeedEncoding.set('?');
			dontNeedEncoding.set('&');
			dontNeedEncoding.set('=');
			dontNeedEncoding.set('+');
		}
	};



> redirect with umlauts fails
> ---------------------------
>
>                 Key: WICKET-2007
>                 URL: https://issues.apache.org/jira/browse/WICKET-2007
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.3.5, 1.4-RC1
>            Reporter: Sven Meier
>
> A redirect does not contain encoding information - contentType seems to be ignored by IE and Firefox.
> Neither does Wicket encode the URL of a redirect according to IRequestCycle#responseRequestEncoding.
> Thus the browser cannot correctly decode umlauts in a redirect's target.
> Thus I propose, that WebResponse#redirect(String) should always encode the given URL.
> I'm currently using a subclass of WebResponse which utiilizes a tweaked WicketURLEncoder to encode all umlauts:
> 	public void redirect(String url) {
> 		url = redirectEncoder.encode(url);
> 		super.redirect(url);
> 	}
> 	// don't encode any delimiter
> 	private static final WicketURLEncoder redirectEncoder = new WicketURLEncoder(-1) {
> 		{
> 			dontNeedEncoding.set(' ');
> 			dontNeedEncoding.set('/');
> 			dontNeedEncoding.set('?');
> 			dontNeedEncoding.set('&');
> 			dontNeedEncoding.set('=');
> 			dontNeedEncoding.set('+');
> 			dontNeedEncoding.set(';');
> 		}
> 	};
> Note that specifying the URIEncoding on the Tomcat connector does *not* solve the problem.
> (http://wiki.apache.org/tomcat/FAQ/Connectors#Q8)

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