32
32
* UriComponentsBuilder with additional static factory methods to create links
33
33
* based on the current HttpServletRequest.
34
34
*
35
- * <p><strong>Note:</strong> This class uses values from "Forwarded"
36
- * (<a href="http://tools.ietf.org/html/rfc7239">RFC 7239</a>),
37
- * "X-Forwarded-Host", "X-Forwarded-Port", and "X-Forwarded-Proto" headers,
38
- * if present, in order to reflect the client-originated protocol and address.
39
- * Consider using the {@code ForwardedHeaderFilter} in order to choose from a
40
- * central place whether to extract and use, or to discard such headers.
41
- * See the Spring Framework reference for more on this filter.
35
+ * <p><strong>Note:</strong> As of 5.1, methods in this class do not extract
36
+ * {@code "Forwarded"} and {@code "X-Forwarded-*"} headers that specify the
37
+ * client-originated address. Please, use
38
+ * {@link org.springframework.web.filter.ForwardedHeaderFilter
39
+ * ForwardedHeaderFilter}, or similar from the underlying server, to extract
40
+ * and use such headers, or to discard them.
42
41
*
43
42
* @author Rossen Stoyanchev
44
43
* @since 3.1
@@ -76,10 +75,6 @@ protected ServletUriComponentsBuilder(ServletUriComponentsBuilder other) {
76
75
/**
77
76
* Prepare a builder from the host, port, scheme, and context path of the
78
77
* given HttpServletRequest.
79
- * <p><strong>Note:</strong> As of 5.1, this method ignores
80
- * {@code "Forwarded"} and {@code "X-Forwarded-*"} headers that specify the
81
- * client-originated address. Consider using the {@code ForwardedHeaderFilter}
82
- * to extract and use, or to discard such headers.
83
78
*/
84
79
public static ServletUriComponentsBuilder fromContextPath (HttpServletRequest request ) {
85
80
ServletUriComponentsBuilder builder = initFromRequest (request );
@@ -94,10 +89,6 @@ public static ServletUriComponentsBuilder fromContextPath(HttpServletRequest req
94
89
* will end with "/main". If the servlet is mapped otherwise, e.g.
95
90
* {@code "/"} or {@code "*.do"}, the result will be the same as
96
91
* if calling {@link #fromContextPath(HttpServletRequest)}.
97
- * <p><strong>Note:</strong> As of 5.1, this method ignores
98
- * {@code "Forwarded"} and {@code "X-Forwarded-*"} headers that specify the
99
- * client-originated address. Consider using the {@code ForwardedHeaderFilter}
100
- * to extract and use, or to discard such headers.
101
92
*/
102
93
public static ServletUriComponentsBuilder fromServletMapping (HttpServletRequest request ) {
103
94
ServletUriComponentsBuilder builder = fromContextPath (request );
@@ -110,10 +101,6 @@ public static ServletUriComponentsBuilder fromServletMapping(HttpServletRequest
110
101
/**
111
102
* Prepare a builder from the host, port, scheme, and path (but not the query)
112
103
* of the HttpServletRequest.
113
- * <p><strong>Note:</strong> As of 5.1, this method ignores
114
- * {@code "Forwarded"} and {@code "X-Forwarded-*"} headers that specify the
115
- * client-originated address. Consider using the {@code ForwardedHeaderFilter}
116
- * to extract and use, or to discard such headers.
117
104
*/
118
105
public static ServletUriComponentsBuilder fromRequestUri (HttpServletRequest request ) {
119
106
ServletUriComponentsBuilder builder = initFromRequest (request );
@@ -124,10 +111,6 @@ public static ServletUriComponentsBuilder fromRequestUri(HttpServletRequest requ
124
111
/**
125
112
* Prepare a builder by copying the scheme, host, port, path, and
126
113
* query string of an HttpServletRequest.
127
- * <p><strong>Note:</strong> As of 5.1, this method ignores
128
- * {@code "Forwarded"} and {@code "X-Forwarded-*"} headers that specify the
129
- * client-originated address. Consider using the {@code ForwardedHeaderFilter}
130
- * to extract and use, or to discard such headers.
131
114
*/
132
115
public static ServletUriComponentsBuilder fromRequest (HttpServletRequest request ) {
133
116
ServletUriComponentsBuilder builder = initFromRequest (request );
@@ -159,11 +142,6 @@ private static ServletUriComponentsBuilder initFromRequest(HttpServletRequest re
159
142
/**
160
143
* Same as {@link #fromContextPath(HttpServletRequest)} except the
161
144
* request is obtained through {@link RequestContextHolder}.
162
- * <p><strong>Note:</strong> This method extracts values from "Forwarded"
163
- * and "X-Forwarded-*" headers if found. See class-level docs.
164
- * <p>As of 4.3.15, this method replaces the contextPath with the value
165
- * of "X-Forwarded-Prefix" rather than prepending, thus aligning with
166
- * {@code ForwardedHeaderFilter}.
167
145
*/
168
146
public static ServletUriComponentsBuilder fromCurrentContextPath () {
169
147
return fromContextPath (getCurrentRequest ());
@@ -172,11 +150,6 @@ public static ServletUriComponentsBuilder fromCurrentContextPath() {
172
150
/**
173
151
* Same as {@link #fromServletMapping(HttpServletRequest)} except the
174
152
* request is obtained through {@link RequestContextHolder}.
175
- * <p><strong>Note:</strong> This method extracts values from "Forwarded"
176
- * and "X-Forwarded-*" headers if found. See class-level docs.
177
- * <p>As of 4.3.15, this method replaces the contextPath with the value
178
- * of "X-Forwarded-Prefix" rather than prepending, thus aligning with
179
- * {@code ForwardedHeaderFilter}.
180
153
*/
181
154
public static ServletUriComponentsBuilder fromCurrentServletMapping () {
182
155
return fromServletMapping (getCurrentRequest ());
@@ -185,11 +158,6 @@ public static ServletUriComponentsBuilder fromCurrentServletMapping() {
185
158
/**
186
159
* Same as {@link #fromRequestUri(HttpServletRequest)} except the
187
160
* request is obtained through {@link RequestContextHolder}.
188
- * <p><strong>Note:</strong> This method extracts values from "Forwarded"
189
- * and "X-Forwarded-*" headers if found. See class-level docs.
190
- * <p>As of 4.3.15, this method replaces the contextPath with the value
191
- * of "X-Forwarded-Prefix" rather than prepending, thus aligning with
192
- * {@code ForwardedHeaderFilter}.
193
161
*/
194
162
public static ServletUriComponentsBuilder fromCurrentRequestUri () {
195
163
return fromRequestUri (getCurrentRequest ());
@@ -198,11 +166,6 @@ public static ServletUriComponentsBuilder fromCurrentRequestUri() {
198
166
/**
199
167
* Same as {@link #fromRequest(HttpServletRequest)} except the
200
168
* request is obtained through {@link RequestContextHolder}.
201
- * <p><strong>Note:</strong> This method extracts values from "Forwarded"
202
- * and "X-Forwarded-*" headers if found. See class-level docs.
203
- * <p>As of 4.3.15, this method replaces the contextPath with the value
204
- * of "X-Forwarded-Prefix" rather than prepending, thus aligning with
205
- * {@code ForwardedHeaderFilter}.
206
169
*/
207
170
public static ServletUriComponentsBuilder fromCurrentRequest () {
208
171
return fromRequest (getCurrentRequest ());
0 commit comments