5252 * "/WEB-INF/jsp/test.jsp"
5353 *
5454 * <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
5656 * URL, rather than resolution as standard view name. This is typically used
5757 * for redirecting to a controller URL after finishing a form workflow.
5858 *
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
6161 * resolution as standard view name. This is typically used for controller URLs;
6262 * it is not supposed to be used for JSP URLs - use logical view names there.
6363 *
@@ -224,7 +224,7 @@ protected String getContentType() {
224224 * interpreted as relative to the web application root, i.e. the context
225225 * path will be prepended to the URL.
226226 * <p><b>Redirect URLs can be specified via the "redirect:" prefix.</b>
227- * E.g.: "redirect:myAction.do "
227+ * E.g.: "redirect:myAction"
228228 * @see RedirectView#setContextRelative
229229 * @see #REDIRECT_URL_PREFIX
230230 */
@@ -251,7 +251,7 @@ protected boolean isRedirectContextRelative() {
251251 * difference. However, some clients depend on 303 when redirecting
252252 * after a POST request; turn this flag off in such a scenario.
253253 * <p><b>Redirect URLs can be specified via the "redirect:" prefix.</b>
254- * E.g.: "redirect:myAction.do "
254+ * E.g.: "redirect:myAction"
255255 * @see RedirectView#setHttp10Compatible
256256 * @see #REDIRECT_URL_PREFIX
257257 */
@@ -469,21 +469,26 @@ protected View createView(String viewName, Locale locale) throws Exception {
469469 if (!canHandle (viewName , locale )) {
470470 return null ;
471471 }
472+
472473 // Check for special "redirect:" prefix.
473474 if (viewName .startsWith (REDIRECT_URL_PREFIX )) {
474475 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 ());
476478 String [] hosts = getRedirectHosts ();
477479 if (hosts != null ) {
478480 view .setHosts (hosts );
479481 }
480- return applyLifecycleMethods (viewName , view );
482+ return applyLifecycleMethods (REDIRECT_URL_PREFIX , view );
481483 }
484+
482485 // Check for special "forward:" prefix.
483486 if (viewName .startsWith (FORWARD_URL_PREFIX )) {
484487 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 );
486490 }
491+
487492 // Else fall back to superclass implementation: calling loadView.
488493 return super .createView (viewName , locale );
489494 }
0 commit comments