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/06 15:12:44 UTC

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

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.4-RC1, 1.3.5
            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('+');
		}
	};


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


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

Posted by "Sven Meier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2007?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

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

           Description: 
When Wicket sends a redirect, it  doesn't encode the URL of the "Location:" header - it just writes it out as it is.
Because a redirect does not contain encoding information, the browser cannot correctly decode containing umlauts.

Setting a contentType seems not to be relavant in a response with HTTP status 3xx , both IE and Firefox seem to disregard it.

Thus I propose, that WebResponse#redirect(String) should always encode the given URL according to IRequestCycle#responseRequestEncoding or perhaps fixed to "UTF-8".

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 (as required for Ajax requests) does *not* solve the problem.
(http://wiki.apache.org/tomcat/FAQ/Connectors#Q8)
(http://cwiki.apache.org/WW/how-to-support-utf-8-uriencoding-with-tomcat.html) 

  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('+');
			dontNeedEncoding.set(';');
		}
	};

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

    Remaining Estimate: 1h
     Original Estimate: 1h

> 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
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> When Wicket sends a redirect, it  doesn't encode the URL of the "Location:" header - it just writes it out as it is.
> Because a redirect does not contain encoding information, the browser cannot correctly decode containing umlauts.
> Setting a contentType seems not to be relavant in a response with HTTP status 3xx , both IE and Firefox seem to disregard it.
> Thus I propose, that WebResponse#redirect(String) should always encode the given URL according to IRequestCycle#responseRequestEncoding or perhaps fixed to "UTF-8".
> 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 (as required for Ajax requests) does *not* solve the problem.
> (http://wiki.apache.org/tomcat/FAQ/Connectors#Q8)
> (http://cwiki.apache.org/WW/how-to-support-utf-8-uriencoding-with-tomcat.html) 

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


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

Posted by "Sven Meier (JIRA)" <ji...@apache.org>.
     [ 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.


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

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2007?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12664868#action_12664868 ] 

Juergen Donnerstag commented on WICKET-2007:
--------------------------------------------

wicket 1.4 trunk seems to do the encoding

	@Override
	public void redirect(String url)
	{
		if (!redirect)
		{
			if (httpServletResponse != null)
			{
				// encode to make sure no caller forgot this
>>> HERE 		url = httpServletResponse.encodeRedirectURL(url);
                               ...
					else
					{
						httpServletResponse.sendRedirect(url);
					}

Could you please provide a quickstart or testcase with an example that is not working. Thanks.

> 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
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> When Wicket sends a redirect, it  doesn't encode the URL of the "Location:" header - it just writes it out as it is.
> Because a redirect does not contain encoding information, the browser cannot correctly decode containing umlauts.
> Setting a contentType seems not to be relavant in a response with HTTP status 3xx , both IE and Firefox seem to disregard it.
> Thus I propose, that WebResponse#redirect(String) should always encode the given URL according to IRequestCycle#responseRequestEncoding or perhaps fixed to "UTF-8".
> 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 (as required for Ajax requests) does *not* solve the problem.
> (http://wiki.apache.org/tomcat/FAQ/Connectors#Q8)
> (http://cwiki.apache.org/WW/how-to-support-utf-8-uriencoding-with-tomcat.html) 

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


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

Posted by "Sven Meier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2007?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sven Meier closed WICKET-2007.
------------------------------

    Resolution: Invalid

Developer's error, see last comment.

> 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
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> When Wicket sends a redirect, it  doesn't encode the URL of the "Location:" header - it just writes it out as it is.
> Because a redirect does not contain encoding information, the browser cannot correctly decode containing umlauts.
> Setting a contentType seems not to be relavant in a response with HTTP status 3xx , both IE and Firefox seem to disregard it.
> Thus I propose, that WebResponse#redirect(String) should always encode the given URL according to IRequestCycle#responseRequestEncoding or perhaps fixed to "UTF-8".
> 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 (as required for Ajax requests) does *not* solve the problem.
> (http://wiki.apache.org/tomcat/FAQ/Connectors#Q8)
> (http://cwiki.apache.org/WW/how-to-support-utf-8-uriencoding-with-tomcat.html) 

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


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

Posted by "Sven Meier (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2007?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12664945#action_12664945 ] 

Sven Meier commented on WICKET-2007:
------------------------------------

HttpServletResponse#encodeRedirectURL() just appends a session id (if required). It doesn't encode umlauts or other special characters.

I'll try to build a small example.

> 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
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> When Wicket sends a redirect, it  doesn't encode the URL of the "Location:" header - it just writes it out as it is.
> Because a redirect does not contain encoding information, the browser cannot correctly decode containing umlauts.
> Setting a contentType seems not to be relavant in a response with HTTP status 3xx , both IE and Firefox seem to disregard it.
> Thus I propose, that WebResponse#redirect(String) should always encode the given URL according to IRequestCycle#responseRequestEncoding or perhaps fixed to "UTF-8".
> 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 (as required for Ajax requests) does *not* solve the problem.
> (http://wiki.apache.org/tomcat/FAQ/Connectors#Q8)
> (http://cwiki.apache.org/WW/how-to-support-utf-8-uriencoding-with-tomcat.html) 

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


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

Posted by "Sven Meier (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2007?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12665099#action_12665099 ] 

Sven Meier commented on WICKET-2007:
------------------------------------

It seems, I was chasing the wrong chicken: Wicket generates properly encoded URLs at all times.

We're generating URLs in text emails which trigger a download page. If the user is not logged in, he will be redirected to an intercept page for authentication.
Note that these URLs were non-encoded.

*Only in this case* Wicket uses this URL blindly (non-encoded) in its redirect. But IMHO we can't blame the framework for this.

Solution: We're now correctly generating encoded URLs in our text emails.

> 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
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> When Wicket sends a redirect, it  doesn't encode the URL of the "Location:" header - it just writes it out as it is.
> Because a redirect does not contain encoding information, the browser cannot correctly decode containing umlauts.
> Setting a contentType seems not to be relavant in a response with HTTP status 3xx , both IE and Firefox seem to disregard it.
> Thus I propose, that WebResponse#redirect(String) should always encode the given URL according to IRequestCycle#responseRequestEncoding or perhaps fixed to "UTF-8".
> 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 (as required for Ajax requests) does *not* solve the problem.
> (http://wiki.apache.org/tomcat/FAQ/Connectors#Q8)
> (http://cwiki.apache.org/WW/how-to-support-utf-8-uriencoding-with-tomcat.html) 

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