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/30 14:27:59 UTC
[jira] Created: (WICKET-2061) interceptContinuationURL with umlauts
not encoded
interceptContinuationURL with umlauts not encoded
-------------------------------------------------
Key: WICKET-2061
URL: https://issues.apache.org/jira/browse/WICKET-2061
Project: Wicket
Issue Type: Bug
Components: wicket
Affects Versions: 1.4-RC1, 1.3.5, 1.3.6
Reporter: Sven Meier
This is my second try to fix Wicket's encoding of redirects to intercepted URLs.
Instead of reopening WICKET-2007, I decided to create this new issue and make a clean start.
When Wicket redirects to an intercept page, it stores the original URL in PageMap#interceptContinuationURL.
// The intercept continuation URL should be saved exactly as the
// original request specified.
...
interceptContinuationURL = "/" + cycle.getRequest().getURL();
Note that comment and code are not in sync:
Instead of saving *exactly* the original request, a new URL is generated. ServletWebRequest#getURL() does *not* encode special characters. Thus on a later continuation, the redirect to the original URL fails in case of special characters (umlauts in our case).
The following patch would save *almost* the original request (it has to remove the context path because RedirectRequestTarget prepends it later on).
I cannot say if this solution has unwanted side effects though:
Index: src/main/java/org/apache/wicket/PageMap.java
===================================================================
RCS file: /boss/dev/src/main/java/org/apache/wicket/PageMap.java,v
retrieving revision 1.1
diff -u -r1.1 PageMap.java
--- src/main/java/org/apache/wicket/PageMap.java 30 Jan 2009 12:54:41 -0000 1.1
+++ src/main/java/org/apache/wicket/PageMap.java 30 Jan 2009 12:55:02 -0000
@@ -262,7 +262,10 @@
}
else
{
- interceptContinuationURL = "/" + cycle.getRequest().getURL();
+ WebRequest request = (WebRequest) cycle.getRequest();
+ String uri = request.getHttpServletRequest().getRequestURI();
+ String contextPath = request.getHttpServletRequest().getContextPath();
+ interceptContinuationURL = uri.substring(contextPath.length());
}
Note that the encoding done in WebResponse#redirect(String) appends a session id only, it doesn't handle special characters (e.g. umlauts).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
Re: [jira] Commented: (WICKET-2061) interceptContinuationURL with
umlauts not encoded
Posted by Juergen Donnerstag <ju...@gmail.com>.
yes, I'll do
Juergen
[jira] Resolved: (WICKET-2061) interceptContinuationURL with
umlauts not encoded
Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-2061?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Juergen Donnerstag resolved WICKET-2061.
----------------------------------------
Resolution: Fixed
Fix Version/s: 1.4-RC3
Assignee: Juergen Donnerstag
thanks. Fixed in 1.4 trunk
> interceptContinuationURL with umlauts not encoded
> -------------------------------------------------
>
> Key: WICKET-2061
> URL: https://issues.apache.org/jira/browse/WICKET-2061
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.5, 1.3.6, 1.4-RC1
> Reporter: Sven Meier
> Assignee: Juergen Donnerstag
> Fix For: 1.4-RC3
>
> Attachments: encodingtest.zip
>
>
> This is my second try to fix Wicket's encoding of redirects to intercepted URLs.
> Instead of reopening WICKET-2007, I decided to create this new issue and make a clean start.
> When Wicket redirects to an intercept page, it stores the original URL in PageMap#interceptContinuationURL.
> // The intercept continuation URL should be saved exactly as the
> // original request specified.
> ...
> interceptContinuationURL = "/" + cycle.getRequest().getURL();
> Note that comment and code are not in sync:
> Instead of saving *exactly* the original request, a new URL is generated. ServletWebRequest#getURL() includes special characters non-encoded. Thus on a later continuation, the redirect to the original URL fails in case of special characters (umlauts in our case).
> We're now using a subclass of ServletWebRequest, which utilizes the requestURI:
> public String getURL()
> {
> // servletPath is de-encoded, so use requestURI minus contextPath instead
> // String url = getServletPath();
> String url = httpServletRequest.getRequestURI().substring(
> httpServletRequest.getContextPath().length());
> final String pathInfo = getHttpServletRequest().getPathInfo();
> ...
> }
> I cannot say if this solution has unwanted side effects though.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WICKET-2061) interceptContinuationURL with
umlauts not encoded
Posted by "Sven Meier (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-2061?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12676011#action_12676011 ]
Sven Meier commented on WICKET-2061:
------------------------------------
Juergen, thank you very much for attending this issue - works fine now.
> interceptContinuationURL with umlauts not encoded
> -------------------------------------------------
>
> Key: WICKET-2061
> URL: https://issues.apache.org/jira/browse/WICKET-2061
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.5, 1.3.6, 1.4-RC1
> Reporter: Sven Meier
> Assignee: Juergen Donnerstag
> Fix For: 1.4-RC3
>
> Attachments: encodingtest.zip
>
>
> This is my second try to fix Wicket's encoding of redirects to intercepted URLs.
> Instead of reopening WICKET-2007, I decided to create this new issue and make a clean start.
> When Wicket redirects to an intercept page, it stores the original URL in PageMap#interceptContinuationURL.
> // The intercept continuation URL should be saved exactly as the
> // original request specified.
> ...
> interceptContinuationURL = "/" + cycle.getRequest().getURL();
> Note that comment and code are not in sync:
> Instead of saving *exactly* the original request, a new URL is generated. ServletWebRequest#getURL() includes special characters non-encoded. Thus on a later continuation, the redirect to the original URL fails in case of special characters (umlauts in our case).
> We're now using a subclass of ServletWebRequest, which utilizes the requestURI:
> public String getURL()
> {
> // servletPath is de-encoded, so use requestURI minus contextPath instead
> // String url = getServletPath();
> String url = httpServletRequest.getRequestURI().substring(
> httpServletRequest.getContextPath().length());
> final String pathInfo = getHttpServletRequest().getPathInfo();
> ...
> }
> I cannot say if this solution has unwanted side effects though.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (WICKET-2061) interceptContinuationURL with umlauts
not encoded
Posted by "Sven Meier (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-2061?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sven Meier updated WICKET-2061:
-------------------------------
Attachment: encodingtest.zip
The promised example.
Note that the problem occurs only, if the umlauts are part of the request path.
> interceptContinuationURL with umlauts not encoded
> -------------------------------------------------
>
> Key: WICKET-2061
> URL: https://issues.apache.org/jira/browse/WICKET-2061
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.5, 1.3.6, 1.4-RC1
> Reporter: Sven Meier
> Attachments: encodingtest.zip
>
>
> This is my second try to fix Wicket's encoding of redirects to intercepted URLs.
> Instead of reopening WICKET-2007, I decided to create this new issue and make a clean start.
> When Wicket redirects to an intercept page, it stores the original URL in PageMap#interceptContinuationURL.
> // The intercept continuation URL should be saved exactly as the
> // original request specified.
> ...
> interceptContinuationURL = "/" + cycle.getRequest().getURL();
> Note that comment and code are not in sync:
> Instead of saving *exactly* the original request, a new URL is generated. ServletWebRequest#getURL() does *not* encode special characters. Thus on a later continuation, the redirect to the original URL fails in case of special characters (umlauts in our case).
> The following patch would save *almost* the original request (it has to remove the context path because RedirectRequestTarget prepends it later on).
> I cannot say if this solution has unwanted side effects though:
> Index: src/main/java/org/apache/wicket/PageMap.java
> ===================================================================
> RCS file: /boss/dev/src/main/java/org/apache/wicket/PageMap.java,v
> retrieving revision 1.1
> diff -u -r1.1 PageMap.java
> --- src/main/java/org/apache/wicket/PageMap.java 30 Jan 2009 12:54:41 -0000 1.1
> +++ src/main/java/org/apache/wicket/PageMap.java 30 Jan 2009 12:55:02 -0000
> @@ -262,7 +262,10 @@
> }
> else
> {
> - interceptContinuationURL = "/" + cycle.getRequest().getURL();
> + WebRequest request = (WebRequest) cycle.getRequest();
> + String uri = request.getHttpServletRequest().getRequestURI();
> + String contextPath = request.getHttpServletRequest().getContextPath();
> + interceptContinuationURL = uri.substring(contextPath.length());
> }
>
> Note that the encoding done in WebResponse#redirect(String) appends a session id only, it doesn't handle special characters (e.g. umlauts).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WICKET-2061) interceptContinuationURL with
umlauts not encoded
Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-2061?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12675125#action_12675125 ]
Juergen Donnerstag commented on WICKET-2061:
--------------------------------------------
done
> interceptContinuationURL with umlauts not encoded
> -------------------------------------------------
>
> Key: WICKET-2061
> URL: https://issues.apache.org/jira/browse/WICKET-2061
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.5, 1.3.6, 1.4-RC1
> Reporter: Sven Meier
> Assignee: Juergen Donnerstag
> Fix For: 1.4-RC3
>
> Attachments: encodingtest.zip
>
>
> This is my second try to fix Wicket's encoding of redirects to intercepted URLs.
> Instead of reopening WICKET-2007, I decided to create this new issue and make a clean start.
> When Wicket redirects to an intercept page, it stores the original URL in PageMap#interceptContinuationURL.
> // The intercept continuation URL should be saved exactly as the
> // original request specified.
> ...
> interceptContinuationURL = "/" + cycle.getRequest().getURL();
> Note that comment and code are not in sync:
> Instead of saving *exactly* the original request, a new URL is generated. ServletWebRequest#getURL() includes special characters non-encoded. Thus on a later continuation, the redirect to the original URL fails in case of special characters (umlauts in our case).
> We're now using a subclass of ServletWebRequest, which utilizes the requestURI:
> public String getURL()
> {
> // servletPath is de-encoded, so use requestURI minus contextPath instead
> // String url = getServletPath();
> String url = httpServletRequest.getRequestURI().substring(
> httpServletRequest.getContextPath().length());
> final String pathInfo = getHttpServletRequest().getPathInfo();
> ...
> }
> I cannot say if this solution has unwanted side effects though.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (WICKET-2061) interceptContinuationURL with
umlauts not encoded
Posted by "Matej Knopp (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-2061?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12675120#action_12675120 ]
Matej Knopp commented on WICKET-2061:
-------------------------------------
Juergen, the unit tests are broken on Mac. Obviously the default encoding of java file is not the same as you used (RequestEncodingTest). Can you escape the accented characters in strings?
> interceptContinuationURL with umlauts not encoded
> -------------------------------------------------
>
> Key: WICKET-2061
> URL: https://issues.apache.org/jira/browse/WICKET-2061
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.5, 1.3.6, 1.4-RC1
> Reporter: Sven Meier
> Assignee: Juergen Donnerstag
> Fix For: 1.4-RC3
>
> Attachments: encodingtest.zip
>
>
> This is my second try to fix Wicket's encoding of redirects to intercepted URLs.
> Instead of reopening WICKET-2007, I decided to create this new issue and make a clean start.
> When Wicket redirects to an intercept page, it stores the original URL in PageMap#interceptContinuationURL.
> // The intercept continuation URL should be saved exactly as the
> // original request specified.
> ...
> interceptContinuationURL = "/" + cycle.getRequest().getURL();
> Note that comment and code are not in sync:
> Instead of saving *exactly* the original request, a new URL is generated. ServletWebRequest#getURL() includes special characters non-encoded. Thus on a later continuation, the redirect to the original URL fails in case of special characters (umlauts in our case).
> We're now using a subclass of ServletWebRequest, which utilizes the requestURI:
> public String getURL()
> {
> // servletPath is de-encoded, so use requestURI minus contextPath instead
> // String url = getServletPath();
> String url = httpServletRequest.getRequestURI().substring(
> httpServletRequest.getContextPath().length());
> final String pathInfo = getHttpServletRequest().getPathInfo();
> ...
> }
> I cannot say if this solution has unwanted side effects though.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (WICKET-2061) interceptContinuationURL with umlauts
not encoded
Posted by "Sven Meier (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-2061?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sven Meier updated WICKET-2061:
-------------------------------
Description:
This is my second try to fix Wicket's encoding of redirects to intercepted URLs.
Instead of reopening WICKET-2007, I decided to create this new issue and make a clean start.
When Wicket redirects to an intercept page, it stores the original URL in PageMap#interceptContinuationURL.
// The intercept continuation URL should be saved exactly as the
// original request specified.
...
interceptContinuationURL = "/" + cycle.getRequest().getURL();
Note that comment and code are not in sync:
Instead of saving *exactly* the original request, a new URL is generated. ServletWebRequest#getURL() includes special characters non-encoded. Thus on a later continuation, the redirect to the original URL fails in case of special characters (umlauts in our case).
We're now using a subclass of ServletWebRequest, which utilizes the requestURI:
public String getURL()
{
// servletPath is de-encoded, so use requestURI minus contextPath instead
// String url = getServletPath();
String url = httpServletRequest.getRequestURI().substring(
httpServletRequest.getContextPath().length());
final String pathInfo = getHttpServletRequest().getPathInfo();
...
}
I cannot say if this solution has unwanted side effects though.
was:
This is my second try to fix Wicket's encoding of redirects to intercepted URLs.
Instead of reopening WICKET-2007, I decided to create this new issue and make a clean start.
When Wicket redirects to an intercept page, it stores the original URL in PageMap#interceptContinuationURL.
// The intercept continuation URL should be saved exactly as the
// original request specified.
...
interceptContinuationURL = "/" + cycle.getRequest().getURL();
Note that comment and code are not in sync:
Instead of saving *exactly* the original request, a new URL is generated. ServletWebRequest#getURL() does *not* encode special characters. Thus on a later continuation, the redirect to the original URL fails in case of special characters (umlauts in our case).
The following patch would save *almost* the original request (it has to remove the context path because RedirectRequestTarget prepends it later on).
I cannot say if this solution has unwanted side effects though:
Index: src/main/java/org/apache/wicket/PageMap.java
===================================================================
RCS file: /boss/dev/src/main/java/org/apache/wicket/PageMap.java,v
retrieving revision 1.1
diff -u -r1.1 PageMap.java
--- src/main/java/org/apache/wicket/PageMap.java 30 Jan 2009 12:54:41 -0000 1.1
+++ src/main/java/org/apache/wicket/PageMap.java 30 Jan 2009 12:55:02 -0000
@@ -262,7 +262,10 @@
}
else
{
- interceptContinuationURL = "/" + cycle.getRequest().getURL();
+ WebRequest request = (WebRequest) cycle.getRequest();
+ String uri = request.getHttpServletRequest().getRequestURI();
+ String contextPath = request.getHttpServletRequest().getContextPath();
+ interceptContinuationURL = uri.substring(contextPath.length());
}
Note that the encoding done in WebResponse#redirect(String) appends a session id only, it doesn't handle special characters (e.g. umlauts).
> interceptContinuationURL with umlauts not encoded
> -------------------------------------------------
>
> Key: WICKET-2061
> URL: https://issues.apache.org/jira/browse/WICKET-2061
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.5, 1.3.6, 1.4-RC1
> Reporter: Sven Meier
> Attachments: encodingtest.zip
>
>
> This is my second try to fix Wicket's encoding of redirects to intercepted URLs.
> Instead of reopening WICKET-2007, I decided to create this new issue and make a clean start.
> When Wicket redirects to an intercept page, it stores the original URL in PageMap#interceptContinuationURL.
> // The intercept continuation URL should be saved exactly as the
> // original request specified.
> ...
> interceptContinuationURL = "/" + cycle.getRequest().getURL();
> Note that comment and code are not in sync:
> Instead of saving *exactly* the original request, a new URL is generated. ServletWebRequest#getURL() includes special characters non-encoded. Thus on a later continuation, the redirect to the original URL fails in case of special characters (umlauts in our case).
> We're now using a subclass of ServletWebRequest, which utilizes the requestURI:
> public String getURL()
> {
> // servletPath is de-encoded, so use requestURI minus contextPath instead
> // String url = getServletPath();
> String url = httpServletRequest.getRequestURI().substring(
> httpServletRequest.getContextPath().length());
> final String pathInfo = getHttpServletRequest().getPathInfo();
> ...
> }
> I cannot say if this solution has unwanted side effects though.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.