1
1
/*
2
- * Copyright 2002-2018 the original author or authors.
2
+ * Copyright 2002-2019 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
44
44
* URI template in which case the URI template variables will be replaced with
45
45
* values from the model or with URI variables from the current request.
46
46
*
47
- * <p>By default {@link HttpStatus#SEE_OTHER} is used but alternate status
48
- * codes may be via constructor or setters arguments.
47
+ * <p>By default {@link HttpStatus#SEE_OTHER} is used but alternate status codes
48
+ * may be via constructor or setters arguments.
49
49
*
50
50
* @author Sebastien Deleuze
51
51
* @author Rossen Stoyanchev
@@ -56,10 +56,10 @@ public class RedirectView extends AbstractUrlBasedView {
56
56
private static final Pattern URI_TEMPLATE_VARIABLE_PATTERN = Pattern .compile ("\\ {([^/]+?)\\ }" );
57
57
58
58
59
- private boolean contextRelative = true ;
60
-
61
59
private HttpStatus statusCode = HttpStatus .SEE_OTHER ;
62
60
61
+ private boolean contextRelative = true ;
62
+
63
63
private boolean propagateQuery = false ;
64
64
65
65
@ Nullable
@@ -91,22 +91,6 @@ public RedirectView(String redirectUrl, HttpStatus statusCode) {
91
91
}
92
92
93
93
94
- /**
95
- * Whether to interpret a given redirect URLs that starts with a slash ("/")
96
- * as relative to the current context path ({@code true}, the default) or to
97
- * the web server root ({@code false}).
98
- */
99
- public void setContextRelative (boolean contextRelative ) {
100
- this .contextRelative = contextRelative ;
101
- }
102
-
103
- /**
104
- * Whether to interpret URLs as relative to the current context path.
105
- */
106
- public boolean isContextRelative () {
107
- return this .contextRelative ;
108
- }
109
-
110
94
/**
111
95
* Set an alternate redirect status code such as
112
96
* {@link HttpStatus#TEMPORARY_REDIRECT} or
@@ -124,6 +108,22 @@ public HttpStatus getStatusCode() {
124
108
return this .statusCode ;
125
109
}
126
110
111
+ /**
112
+ * Whether to interpret a given redirect URLs that starts with a slash ("/")
113
+ * as relative to the current context path ({@code true}, the default) or to
114
+ * the web server root ({@code false}).
115
+ */
116
+ public void setContextRelative (boolean contextRelative ) {
117
+ this .contextRelative = contextRelative ;
118
+ }
119
+
120
+ /**
121
+ * Whether to interpret URLs as relative to the current context path.
122
+ */
123
+ public boolean isContextRelative () {
124
+ return this .contextRelative ;
125
+ }
126
+
127
127
/**
128
128
* Whether to append the query string of the current URL to the redirect URL
129
129
* ({@code true}) or not ({@code false}, the default).
0 commit comments