diff --git a/build-spring-framework/resources/changelog.txt b/build-spring-framework/resources/changelog.txt
index eff2824e93e..ce2299703ba 100644
--- a/build-spring-framework/resources/changelog.txt
+++ b/build-spring-framework/resources/changelog.txt
@@ -27,6 +27,7 @@ Changes in version 3.1.1 (2012-02-06)
* allow adding flash attributes in methods with a ModelAndView return value
* preserve quotes in MediaType parameters
* make flash attributes available in the model of ParameterizableViewController and UrlFilenameViewController
+* add property to RedirectView to disable expanding URI variables in redirect URL
Changes in version 3.1 GA (2011-12-12)
--------------------------------------
diff --git a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/view/RedirectView.java b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/view/RedirectView.java
index 184c9a32841..0e100ee7f34 100644
--- a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/view/RedirectView.java
+++ b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/view/RedirectView.java
@@ -106,6 +106,7 @@ public class RedirectView extends AbstractUrlBasedView implements SmartView {
private HttpStatus statusCode;
+ private boolean expandUriTemplateVariables = true;
/**
* Constructor for use as a bean.
@@ -225,6 +226,18 @@ public class RedirectView extends AbstractUrlBasedView implements SmartView {
this.statusCode = statusCode;
}
+ /**
+ * Whether to treat the redirect URL as a URI template.
+ * Set this flag to false if the redirect URL contains open
+ * and close curly braces "{", "}" and you don't want them interpreted
+ * as URI variables.
+ *
Defaults to true.
+ * @param expandUriTemplateVariables
+ */
+ public void setExpandUriTemplateVariables(boolean expandUriTemplateVariables) {
+ this.expandUriTemplateVariables = expandUriTemplateVariables;
+ }
+
/**
* Returns "true" indicating this view performs a redirect.
*/
@@ -288,7 +301,7 @@ public class RedirectView extends AbstractUrlBasedView implements SmartView {
enc = WebUtils.DEFAULT_CHARACTER_ENCODING;
}
- if (StringUtils.hasText(targetUrl)) {
+ if (this.expandUriTemplateVariables && StringUtils.hasText(targetUrl)) {
Map