SPR-7471 - Regression in redirect URL encoding

This commit is contained in:
Arjen Poutsma
2010-08-19 08:54:42 +00:00
parent 061b2c91a0
commit 001d676dec
2 changed files with 8 additions and 2 deletions

View File

@@ -208,13 +208,13 @@ public class RedirectView extends AbstractUrlBasedView {
throws IOException {
String encoding = getEncoding(request);
// Prepare target URL.
StringBuilder targetUrl = new StringBuilder();
if (this.contextRelative && getUrl().startsWith("/")) {
// Do not apply context path to relative URLs.
targetUrl.append(UriUtils.encodePath(request.getContextPath(), encoding));
targetUrl.append(UriUtils.encodePath(getUrl(), encoding));
targetUrl.append(UriUtils.encodeUri(getUrl(), encoding));
}
else {
targetUrl.append(UriUtils.encodeUri(getUrl(), encoding));