@@ -87,6 +87,35 @@ public void contextPathWithTrailingSlashes() throws Exception {
87
87
assertEquals ("/foo/bar/baz" , filterAndGetContextPath ());
88
88
}
89
89
90
+ @ Test
91
+ public void contextPathWithForwardedPrefix () throws Exception {
92
+ this .request .addHeader (X_FORWARDED_PREFIX , "/prefix" );
93
+ this .request .setContextPath ("/mvc-showcase" );
94
+
95
+ String actual = filterAndGetContextPath ();
96
+ assertEquals ("/prefix" , actual );
97
+ }
98
+
99
+ @ Test
100
+ public void contextPathWithForwardedPrefixTrailingSlash () throws Exception {
101
+ this .request .addHeader (X_FORWARDED_PREFIX , "/prefix/" );
102
+ this .request .setContextPath ("/mvc-showcase" );
103
+
104
+ String actual = filterAndGetContextPath ();
105
+ assertEquals ("/prefix" , actual );
106
+ }
107
+
108
+ @ Test
109
+ public void contextPathPreserveEncoding () throws Exception {
110
+ this .request .setContextPath ("/app%20" );
111
+ this .request .setRequestURI ("/app%20/path/" );
112
+ HttpServletRequest actual = filterAndGetWrappedRequest ();
113
+
114
+ assertEquals ("/app%20" , actual .getContextPath ());
115
+ assertEquals ("/app%20/path/" , actual .getRequestURI ());
116
+ assertEquals ("http://localhost/app%20/path/" , actual .getRequestURL ().toString ());
117
+ }
118
+
90
119
@ Test
91
120
public void requestUri () throws Exception {
92
121
this .request .addHeader (X_FORWARDED_PREFIX , "/" );
@@ -231,35 +260,6 @@ public void requestURLNewStringBuffer() throws Exception {
231
260
assertEquals ("http://localhost/prefix/mvc-showcase" , actual .getRequestURL ().toString ());
232
261
}
233
262
234
- @ Test
235
- public void contextPathWithForwardedPrefix () throws Exception {
236
- this .request .addHeader (X_FORWARDED_PREFIX , "/prefix" );
237
- this .request .setContextPath ("/mvc-showcase" );
238
-
239
- String actual = filterAndGetContextPath ();
240
- assertEquals ("/prefix" , actual );
241
- }
242
-
243
- @ Test
244
- public void contextPathWithForwardedPrefixTrailingSlash () throws Exception {
245
- this .request .addHeader (X_FORWARDED_PREFIX , "/prefix/" );
246
- this .request .setContextPath ("/mvc-showcase" );
247
-
248
- String actual = filterAndGetContextPath ();
249
- assertEquals ("/prefix" , actual );
250
- }
251
-
252
- @ Test
253
- public void contextPathPreserveEncoding () throws Exception {
254
- this .request .setContextPath ("/app%20" );
255
- this .request .setRequestURI ("/app%20/path/" );
256
- HttpServletRequest actual = filterAndGetWrappedRequest ();
257
-
258
- assertEquals ("/app%20" , actual .getContextPath ());
259
- assertEquals ("/app%20/path/" , actual .getRequestURI ());
260
- assertEquals ("http://localhost/app%20/path/" , actual .getRequestURL ().toString ());
261
- }
262
-
263
263
@ Test
264
264
public void sendRedirectWithAbsolutePath () throws Exception {
265
265
this .request .addHeader (X_FORWARDED_PROTO , "https" );
0 commit comments