1
1
/*
2
- * Copyright 2002-2016 the original author or authors.
2
+ * Copyright 2002-2018 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.
@@ -172,9 +172,7 @@ public void updateTargetUrl() throws Exception {
172
172
request .setAttribute (DispatcherServlet .WEB_APPLICATION_CONTEXT_ATTRIBUTE , wac );
173
173
174
174
given (mockProcessor .processUrl (request , "/path" )).willReturn ("/path?key=123" );
175
-
176
175
rv .render (new ModelMap (), request , response );
177
-
178
176
verify (mockProcessor ).processUrl (request , "/path" );
179
177
}
180
178
@@ -196,19 +194,15 @@ public void updateTargetUrlWithContextLoader() throws Exception {
196
194
rv .setUrl ("/path" );
197
195
198
196
given (mockProcessor .processUrl (request , "/path" )).willReturn ("/path?key=123" );
199
-
200
197
rv .render (new ModelMap (), request , response );
201
-
202
198
verify (mockProcessor ).processUrl (request , "/path" );
203
199
}
204
200
finally {
205
201
contextLoader .closeWebApplicationContext (servletContext );
206
202
}
207
203
}
208
204
209
- // SPR-13693
210
-
211
- @ Test
205
+ @ Test // SPR-13693
212
206
public void remoteHost () throws Exception {
213
207
RedirectView rv = new RedirectView ();
214
208
@@ -224,6 +218,19 @@ public void remoteHost() throws Exception {
224
218
225
219
}
226
220
221
+ @ Test // SPR-16752
222
+ public void contextRelativeWithValidatedContextPath () throws Exception {
223
+ String url = "/myUrl" ;
224
+
225
+ this .request .setContextPath ("//context" );
226
+ this .response = new MockHttpServletResponse ();
227
+ doTest (new HashMap <>(), url , true , "/context" + url );
228
+
229
+ this .request .setContextPath ("///context" );
230
+ this .response = new MockHttpServletResponse ();
231
+ doTest (new HashMap <>(), url , true , "/context" + url );
232
+ }
233
+
227
234
@ Test
228
235
public void emptyMap () throws Exception {
229
236
String url = "/myUrl" ;
0 commit comments