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