52
52
* "/WEB-INF/jsp/test.jsp"
53
53
*
54
54
* <p>As a special feature, redirect URLs can be specified via the "redirect:"
55
- * prefix. E.g.: "redirect:myAction.do " will trigger a redirect to the given
55
+ * prefix. E.g.: "redirect:myAction" will trigger a redirect to the given
56
56
* URL, rather than resolution as standard view name. This is typically used
57
57
* for redirecting to a controller URL after finishing a form workflow.
58
58
*
59
- * <p>Furthermore, forward URLs can be specified via the "forward:" prefix. E.g.:
60
- * "forward:myAction.do " will trigger a forward to the given URL, rather than
59
+ * <p>Furthermore, forward URLs can be specified via the "forward:" prefix.
60
+ * E.g.: "forward:myAction" will trigger a forward to the given URL, rather than
61
61
* resolution as standard view name. This is typically used for controller URLs;
62
62
* it is not supposed to be used for JSP URLs - use logical view names there.
63
63
*
@@ -224,7 +224,7 @@ protected String getContentType() {
224
224
* interpreted as relative to the web application root, i.e. the context
225
225
* path will be prepended to the URL.
226
226
* <p><b>Redirect URLs can be specified via the "redirect:" prefix.</b>
227
- * E.g.: "redirect:myAction.do "
227
+ * E.g.: "redirect:myAction"
228
228
* @see RedirectView#setContextRelative
229
229
* @see #REDIRECT_URL_PREFIX
230
230
*/
@@ -251,7 +251,7 @@ protected boolean isRedirectContextRelative() {
251
251
* difference. However, some clients depend on 303 when redirecting
252
252
* after a POST request; turn this flag off in such a scenario.
253
253
* <p><b>Redirect URLs can be specified via the "redirect:" prefix.</b>
254
- * E.g.: "redirect:myAction.do "
254
+ * E.g.: "redirect:myAction"
255
255
* @see RedirectView#setHttp10Compatible
256
256
* @see #REDIRECT_URL_PREFIX
257
257
*/
@@ -469,21 +469,26 @@ protected View createView(String viewName, Locale locale) throws Exception {
469
469
if (!canHandle (viewName , locale )) {
470
470
return null ;
471
471
}
472
+
472
473
// Check for special "redirect:" prefix.
473
474
if (viewName .startsWith (REDIRECT_URL_PREFIX )) {
474
475
String redirectUrl = viewName .substring (REDIRECT_URL_PREFIX .length ());
475
- RedirectView view = new RedirectView (redirectUrl , isRedirectContextRelative (), isRedirectHttp10Compatible ());
476
+ RedirectView view = new RedirectView (redirectUrl ,
477
+ isRedirectContextRelative (), isRedirectHttp10Compatible ());
476
478
String [] hosts = getRedirectHosts ();
477
479
if (hosts != null ) {
478
480
view .setHosts (hosts );
479
481
}
480
- return applyLifecycleMethods (viewName , view );
482
+ return applyLifecycleMethods (REDIRECT_URL_PREFIX , view );
481
483
}
484
+
482
485
// Check for special "forward:" prefix.
483
486
if (viewName .startsWith (FORWARD_URL_PREFIX )) {
484
487
String forwardUrl = viewName .substring (FORWARD_URL_PREFIX .length ());
485
- return new InternalResourceView (forwardUrl );
488
+ InternalResourceView view = new InternalResourceView (forwardUrl );
489
+ return applyLifecycleMethods (FORWARD_URL_PREFIX , view );
486
490
}
491
+
487
492
// Else fall back to superclass implementation: calling loadView.
488
493
return super .createView (viewName , locale );
489
494
}
0 commit comments