33
33
* @author Juergen Hoeller
34
34
* @author Costin Leau
35
35
*/
36
- public class UrlPathHelperTests {
36
+ class UrlPathHelperTests {
37
37
38
38
private static final String WEBSPHERE_URI_ATTRIBUTE = "com.ibm.websphere.servlet.uri_non_decoded" ;
39
39
@@ -43,31 +43,31 @@ public class UrlPathHelperTests {
43
43
44
44
45
45
@ Test
46
- public void getPathWithinApplication () {
46
+ void getPathWithinApplication () {
47
47
request .setContextPath ("/petclinic" );
48
48
request .setRequestURI ("/petclinic/welcome.html" );
49
49
50
50
assertThat (helper .getPathWithinApplication (request )).as ("Incorrect path returned" ).isEqualTo ("/welcome.html" );
51
51
}
52
52
53
53
@ Test
54
- public void getPathWithinApplicationForRootWithNoLeadingSlash () {
54
+ void getPathWithinApplicationForRootWithNoLeadingSlash () {
55
55
request .setContextPath ("/petclinic" );
56
56
request .setRequestURI ("/petclinic" );
57
57
58
58
assertThat (helper .getPathWithinApplication (request )).as ("Incorrect root path returned" ).isEqualTo ("/" );
59
59
}
60
60
61
61
@ Test
62
- public void getPathWithinApplicationForSlashContextPath () {
62
+ void getPathWithinApplicationForSlashContextPath () {
63
63
request .setContextPath ("/" );
64
64
request .setRequestURI ("/welcome.html" );
65
65
66
66
assertThat (helper .getPathWithinApplication (request )).as ("Incorrect path returned" ).isEqualTo ("/welcome.html" );
67
67
}
68
68
69
69
@ Test
70
- public void getPathWithinServlet () {
70
+ void getPathWithinServlet () {
71
71
request .setContextPath ("/petclinic" );
72
72
request .setServletPath ("/main" );
73
73
request .setRequestURI ("/petclinic/main/welcome.html" );
@@ -76,7 +76,7 @@ public void getPathWithinServlet() {
76
76
}
77
77
78
78
@ Test
79
- public void alwaysUseFullPath () {
79
+ void alwaysUseFullPath () {
80
80
helper .setAlwaysUseFullPath (true );
81
81
request .setContextPath ("/petclinic" );
82
82
request .setServletPath ("/main" );
@@ -88,7 +88,7 @@ public void alwaysUseFullPath() {
88
88
// SPR-11101
89
89
90
90
@ Test
91
- public void getPathWithinServletWithoutUrlDecoding () {
91
+ void getPathWithinServletWithoutUrlDecoding () {
92
92
request .setContextPath ("/SPR-11101" );
93
93
request .setServletPath ("/test_url_decoding/a/b" );
94
94
request .setRequestURI ("/test_url_decoding/a%2Fb" );
@@ -100,7 +100,7 @@ public void getPathWithinServletWithoutUrlDecoding() {
100
100
}
101
101
102
102
@ Test
103
- public void getRequestUri () {
103
+ void getRequestUri () {
104
104
request .setRequestURI ("/welcome.html" );
105
105
assertThat (helper .getRequestUri (request )).as ("Incorrect path returned" ).isEqualTo ("/welcome.html" );
106
106
@@ -112,7 +112,7 @@ public void getRequestUri() {
112
112
}
113
113
114
114
@ Test
115
- public void getRequestRemoveSemicolonContent () throws UnsupportedEncodingException {
115
+ void getRequestRemoveSemicolonContent () throws UnsupportedEncodingException {
116
116
helper .setRemoveSemicolonContent (true );
117
117
118
118
request .setRequestURI ("/foo;f=F;o=O;o=O/bar;b=B;a=A;r=R" );
@@ -127,7 +127,7 @@ public void getRequestRemoveSemicolonContent() throws UnsupportedEncodingExcepti
127
127
}
128
128
129
129
@ Test
130
- public void getRequestKeepSemicolonContent () {
130
+ void getRequestKeepSemicolonContent () {
131
131
helper .setRemoveSemicolonContent (false );
132
132
133
133
testKeepSemicolonContent ("/foo;a=b;c=d" , "/foo;a=b;c=d" );
@@ -146,7 +146,7 @@ private void testKeepSemicolonContent(String requestUri, String expectedPath) {
146
146
}
147
147
148
148
@ Test
149
- public void getLookupPathWithSemicolonContent () {
149
+ void getLookupPathWithSemicolonContent () {
150
150
helper .setRemoveSemicolonContent (false );
151
151
152
152
request .setContextPath ("/petclinic" );
@@ -157,7 +157,7 @@ public void getLookupPathWithSemicolonContent() {
157
157
}
158
158
159
159
@ Test
160
- public void getLookupPathWithSemicolonContentAndNullPathInfo () {
160
+ void getLookupPathWithSemicolonContentAndNullPathInfo () {
161
161
helper .setRemoveSemicolonContent (false );
162
162
163
163
request .setContextPath ("/petclinic" );
@@ -168,7 +168,7 @@ public void getLookupPathWithSemicolonContentAndNullPathInfo() {
168
168
}
169
169
170
170
@ Test // gh-27303
171
- public void defaultInstanceReadOnlyBehavior () {
171
+ void defaultInstanceReadOnlyBehavior () {
172
172
UrlPathHelper helper = UrlPathHelper .defaultInstance ;
173
173
174
174
assertThatIllegalArgumentException ()
@@ -200,7 +200,7 @@ public void defaultInstanceReadOnlyBehavior() {
200
200
//
201
201
202
202
@ Test
203
- public void tomcatDefaultServletRoot () throws Exception {
203
+ void tomcatDefaultServletRoot () throws Exception {
204
204
request .setContextPath ("/test" );
205
205
request .setPathInfo (null );
206
206
request .setServletPath ("/" );
@@ -209,7 +209,7 @@ public void tomcatDefaultServletRoot() throws Exception {
209
209
}
210
210
211
211
@ Test
212
- public void tomcatDefaultServletFile () throws Exception {
212
+ void tomcatDefaultServletFile () throws Exception {
213
213
request .setContextPath ("/test" );
214
214
request .setPathInfo (null );
215
215
request .setServletPath ("/foo" );
@@ -219,7 +219,7 @@ public void tomcatDefaultServletFile() throws Exception {
219
219
}
220
220
221
221
@ Test
222
- public void tomcatDefaultServletFolder () throws Exception {
222
+ void tomcatDefaultServletFolder () throws Exception {
223
223
request .setContextPath ("/test" );
224
224
request .setPathInfo (null );
225
225
request .setServletPath ("/foo/" );
@@ -230,7 +230,7 @@ public void tomcatDefaultServletFolder() throws Exception {
230
230
231
231
//SPR-12372 & SPR-13455
232
232
@ Test
233
- public void removeDuplicateSlashesInPath () throws Exception {
233
+ void removeDuplicateSlashesInPath () throws Exception {
234
234
request .setContextPath ("/SPR-12372" );
235
235
request .setPathInfo (null );
236
236
request .setServletPath ("/foo/bar/" );
@@ -251,7 +251,7 @@ public void removeDuplicateSlashesInPath() throws Exception {
251
251
}
252
252
253
253
@ Test
254
- public void wasDefaultServletRoot () throws Exception {
254
+ void wasDefaultServletRoot () throws Exception {
255
255
request .setContextPath ("/test" );
256
256
request .setPathInfo ("/" );
257
257
request .setServletPath ("" );
@@ -262,13 +262,13 @@ public void wasDefaultServletRoot() throws Exception {
262
262
}
263
263
264
264
@ Test
265
- public void wasDefaultServletRootWithCompliantSetting () throws Exception {
265
+ void wasDefaultServletRootWithCompliantSetting () throws Exception {
266
266
request .setAttribute (WEBSPHERE_URI_ATTRIBUTE , "/test/" );
267
267
tomcatDefaultServletRoot ();
268
268
}
269
269
270
270
@ Test
271
- public void wasDefaultServletFile () throws Exception {
271
+ void wasDefaultServletFile () throws Exception {
272
272
request .setContextPath ("/test" );
273
273
request .setPathInfo ("/foo" );
274
274
request .setServletPath ("" );
@@ -279,13 +279,13 @@ public void wasDefaultServletFile() throws Exception {
279
279
}
280
280
281
281
@ Test
282
- public void wasDefaultServletFileWithCompliantSetting () throws Exception {
282
+ void wasDefaultServletFileWithCompliantSetting () throws Exception {
283
283
request .setAttribute (WEBSPHERE_URI_ATTRIBUTE , "/test/foo" );
284
284
tomcatDefaultServletFile ();
285
285
}
286
286
287
287
@ Test
288
- public void wasDefaultServletFolder () throws Exception {
288
+ void wasDefaultServletFolder () throws Exception {
289
289
request .setContextPath ("/test" );
290
290
request .setPathInfo ("/foo/" );
291
291
request .setServletPath ("" );
@@ -296,7 +296,7 @@ public void wasDefaultServletFolder() throws Exception {
296
296
}
297
297
298
298
@ Test
299
- public void wasDefaultServletFolderWithCompliantSetting () throws Exception {
299
+ void wasDefaultServletFolderWithCompliantSetting () throws Exception {
300
300
UrlPathHelper .websphereComplianceFlag = true ;
301
301
try {
302
302
request .setAttribute (WEBSPHERE_URI_ATTRIBUTE , "/test/foo/" );
@@ -313,7 +313,7 @@ public void wasDefaultServletFolderWithCompliantSetting() throws Exception {
313
313
//
314
314
315
315
@ Test
316
- public void tomcatCasualServletRoot () throws Exception {
316
+ void tomcatCasualServletRoot () throws Exception {
317
317
request .setContextPath ("/test" );
318
318
request .setPathInfo ("/" );
319
319
request .setServletPath ("/foo" );
@@ -323,9 +323,9 @@ public void tomcatCasualServletRoot() throws Exception {
323
323
}
324
324
325
325
@ Disabled
326
- // test the root mapping for /foo/* w/o a trailing slash - <host>/<context>/foo
327
326
@ Test
328
- public void tomcatCasualServletRootWithMissingSlash () throws Exception {
327
+ // test the root mapping for /foo/* w/o a trailing slash - <host>/<context>/foo
328
+ void tomcatCasualServletRootWithMissingSlash () throws Exception {
329
329
request .setContextPath ("/test" );
330
330
request .setPathInfo (null );
331
331
request .setServletPath ("/foo" );
@@ -335,7 +335,7 @@ public void tomcatCasualServletRootWithMissingSlash() throws Exception {
335
335
}
336
336
337
337
@ Test
338
- public void tomcatCasualServletFile () throws Exception {
338
+ void tomcatCasualServletFile () throws Exception {
339
339
request .setContextPath ("/test" );
340
340
request .setPathInfo ("/foo" );
341
341
request .setServletPath ("/foo" );
@@ -345,7 +345,7 @@ public void tomcatCasualServletFile() throws Exception {
345
345
}
346
346
347
347
@ Test
348
- public void tomcatCasualServletFolder () throws Exception {
348
+ void tomcatCasualServletFolder () throws Exception {
349
349
request .setContextPath ("/test" );
350
350
request .setPathInfo ("/foo/" );
351
351
request .setServletPath ("/foo" );
@@ -355,7 +355,7 @@ public void tomcatCasualServletFolder() throws Exception {
355
355
}
356
356
357
357
@ Test
358
- public void wasCasualServletRoot () throws Exception {
358
+ void wasCasualServletRoot () throws Exception {
359
359
request .setContextPath ("/test" );
360
360
request .setPathInfo (null );
361
361
request .setServletPath ("/foo/" );
@@ -366,15 +366,15 @@ public void wasCasualServletRoot() throws Exception {
366
366
}
367
367
368
368
@ Test
369
- public void wasCasualServletRootWithCompliantSetting () throws Exception {
369
+ void wasCasualServletRootWithCompliantSetting () throws Exception {
370
370
request .setAttribute (WEBSPHERE_URI_ATTRIBUTE , "/test/foo/" );
371
371
tomcatCasualServletRoot ();
372
372
}
373
373
374
374
@ Disabled
375
- // test the root mapping for /foo/* w/o a trailing slash - <host>/<context>/foo
376
375
@ Test
377
- public void wasCasualServletRootWithMissingSlash () throws Exception {
376
+ // test the root mapping for /foo/* w/o a trailing slash - <host>/<context>/foo
377
+ void wasCasualServletRootWithMissingSlash () throws Exception {
378
378
request .setContextPath ("/test" );
379
379
request .setPathInfo (null );
380
380
request .setServletPath ("/foo" );
@@ -386,13 +386,13 @@ public void wasCasualServletRootWithMissingSlash() throws Exception {
386
386
387
387
@ Disabled
388
388
@ Test
389
- public void wasCasualServletRootWithMissingSlashWithCompliantSetting () throws Exception {
389
+ void wasCasualServletRootWithMissingSlashWithCompliantSetting () throws Exception {
390
390
request .setAttribute (WEBSPHERE_URI_ATTRIBUTE , "/test/foo" );
391
391
tomcatCasualServletRootWithMissingSlash ();
392
392
}
393
393
394
394
@ Test
395
- public void wasCasualServletFile () throws Exception {
395
+ void wasCasualServletFile () throws Exception {
396
396
request .setContextPath ("/test" );
397
397
request .setPathInfo ("/foo" );
398
398
request .setServletPath ("/foo" );
@@ -403,13 +403,13 @@ public void wasCasualServletFile() throws Exception {
403
403
}
404
404
405
405
@ Test
406
- public void wasCasualServletFileWithCompliantSetting () throws Exception {
406
+ void wasCasualServletFileWithCompliantSetting () throws Exception {
407
407
request .setAttribute (WEBSPHERE_URI_ATTRIBUTE , "/test/foo/foo" );
408
408
tomcatCasualServletFile ();
409
409
}
410
410
411
411
@ Test
412
- public void wasCasualServletFolder () throws Exception {
412
+ void wasCasualServletFolder () throws Exception {
413
413
request .setContextPath ("/test" );
414
414
request .setPathInfo ("/foo/" );
415
415
request .setServletPath ("/foo" );
@@ -420,47 +420,47 @@ public void wasCasualServletFolder() throws Exception {
420
420
}
421
421
422
422
@ Test
423
- public void wasCasualServletFolderWithCompliantSetting () throws Exception {
423
+ void wasCasualServletFolderWithCompliantSetting () throws Exception {
424
424
request .setAttribute (WEBSPHERE_URI_ATTRIBUTE , "/test/foo/foo/" );
425
425
tomcatCasualServletFolder ();
426
426
}
427
427
428
428
@ Test
429
- public void getOriginatingRequestUri () {
429
+ void getOriginatingRequestUri () {
430
430
request .setAttribute (WebUtils .FORWARD_REQUEST_URI_ATTRIBUTE , "/path" );
431
431
request .setRequestURI ("/forwarded" );
432
432
assertThat (helper .getOriginatingRequestUri (request )).isEqualTo ("/path" );
433
433
}
434
434
435
435
@ Test
436
- public void getOriginatingRequestUriWebsphere () {
436
+ void getOriginatingRequestUriWebsphere () {
437
437
request .setAttribute (WEBSPHERE_URI_ATTRIBUTE , "/path" );
438
438
request .setRequestURI ("/forwarded" );
439
439
assertThat (helper .getOriginatingRequestUri (request )).isEqualTo ("/path" );
440
440
}
441
441
442
442
@ Test
443
- public void getOriginatingRequestUriDefault () {
443
+ void getOriginatingRequestUriDefault () {
444
444
request .setRequestURI ("/forwarded" );
445
445
assertThat (helper .getOriginatingRequestUri (request )).isEqualTo ("/forwarded" );
446
446
}
447
447
448
448
@ Test
449
- public void getOriginatingQueryString () {
449
+ void getOriginatingQueryString () {
450
450
request .setQueryString ("forward=on" );
451
451
request .setAttribute (WebUtils .FORWARD_REQUEST_URI_ATTRIBUTE , "/path" );
452
452
request .setAttribute (WebUtils .FORWARD_QUERY_STRING_ATTRIBUTE , "original=on" );
453
453
assertThat (this .helper .getOriginatingQueryString (request )).isEqualTo ("original=on" );
454
454
}
455
455
456
456
@ Test
457
- public void getOriginatingQueryStringNotPresent () {
457
+ void getOriginatingQueryStringNotPresent () {
458
458
request .setQueryString ("forward=true" );
459
459
assertThat (this .helper .getOriginatingQueryString (request )).isEqualTo ("forward=true" );
460
460
}
461
461
462
462
@ Test
463
- public void getOriginatingQueryStringIsNull () {
463
+ void getOriginatingQueryStringIsNull () {
464
464
request .setQueryString ("forward=true" );
465
465
request .setAttribute (WebUtils .FORWARD_REQUEST_URI_ATTRIBUTE , "/path" );
466
466
assertThat (this .helper .getOriginatingQueryString (request )).isNull ();
0 commit comments