myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Nicolucci (JIRA)" <>
Subject [jira] [Commented] (MYFACES-3557) ViewNotFoundException using Custom Exception Handler after ViewExpiredException when using implicit navigation and prefix mapping.
Date Mon, 04 Jun 2012 17:38:23 GMT


Paul Nicolucci commented on MYFACES-3557:

Hey Leonardo, let me review the patch you provided by tomorrow and I'll voice any concerns
by the end of the day Tuesday.  I'm going to test this latest patch with the applications
I currently have.

> ViewNotFoundException using Custom Exception Handler after ViewExpiredException when
using implicit navigation and prefix mapping.
> ----------------------------------------------------------------------------------------------------------------------------------
>                 Key: MYFACES-3557
>                 URL:
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.13
>         Environment: WebSphere Application Server  8.0 using MyFaces 2.0.13
>            Reporter: Paul Nicolucci
>         Attachments: MYFACES-3557-2.patch, NavigationHandlerImpl.patch, NavigationHandlerImplTest.patch
>   Original Estimate: 24h
>  Remaining Estimate: 24h
> I have an application which was posted in MyFaces-3530 (ViewExpiredException.war) which
uses a custom ExceptionHandler to deal with a ViewExpiredException.  Everything looks to be
working as expected with this when I'm using a Faces Servlet Mapping such
> as the following (suffix mapping):
> 	<servlet-mapping>
>     		<servlet-name>Faces Servlet</servlet-name>
>    		<url-pattern>*.jsf</url-pattern>
>  	 </servlet-mapping>
> However if I use something such as this (prefix mapping):
> 	<servlet-mapping>
> 		<servlet-name>Faces Servlet</servlet-name>
> 		<url-pattern>/f/*</url-pattern>
> 	</servlet-mapping>
> I get the following exception when doing implicit navigation in my Exception Handler
such as:
> 	nav.handleNavigation(fc, null, "viewExpired");  // viewExpired.xhtml exists in the web
> Exception:
> 	Caused by: org.apache.myfaces.lifecycle.ViewNotFoundException: A view is required to
> 	at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(
> 	at org.apache.myfaces.lifecycle.LifecycleImpl.render(
> 	at javax.faces.webapp.FacesServlet.service(
> According to the JSF 2.0 specification specifically Section 7.4.2:
> "If viewIdToTest does not have a “file extension”, take the file extension from the
current viewId and append it
> properly to viewIdToTest."
> Since the viewId is null after the ViewExpiredException we don't have anything to grab
the file extension from when using implicit navigation in this case.  
> , deals with a similar situation where
we were not adding the "/" prefix when the viewId was null. 
> The only way I could determine the extension we should be using was to call " DefaultRestoreViewSupport.calculateViewId(FacesContext
context)" this uses the RequestServletPath to determine the viewId of the current view.  
> It is also worth taking note in that fact that this only looks to really matter when
using prefix mapping since the algo. in 7.5.2 differs for prefix and suffix mapping.
> I've provided a patch for NavigationHandlerImpl as well as NavigationHandlerImplTest
(As once the patch is applied we don't have all the information in the facesContext given
the current test so we fail, however if we don't use implicit navigation in the test we can
still test that we don't get any NPEs after a VEE )
> If everyone can take a look at the patch and let me know what you think that would be
very helpful.  I'm willing to make changes but I've tested this and it is currently working.
 I'm looking to see if I missed any cases where this would not work.  Patch contains some
comments to explain what is going on and actually added an additional log statement.
> Thanks!

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message