After uncovering some potential performance issues I was having with Mojarra, I recently switched my application to run on MyFaces 2.1.10 implementation from Mojarra 2.1.7.
I have been using the OmniFaces SEO feature that allows for pretty extensionless URL's. This operates through the use of a servlet filter and is automatically enabled by adding a context parameter to the web.xml
as well as adding a directory faces-views
to WEB-INF that mirrors the xhtml document layout of web application.
I was a bit concerned about compatibility issues with Spring however, as I am utilizing the Spring Container and their custom EL resolver that replaces JSF dependency injection with Spring dependency injection, making every managed bean also a Spring bean. Even more worrying is that I am implementing Spring Security which also operates through the use of a servlet filter to intercept and authenticate incoming requests. My worry was that perhaps the two wouldn't work correctly if they happened to be invoked in a certain order.
Well the ExtensionlessURLS feature with Mojarra worked a bit different than what was described in the documentation
I noticed that to get it work in Mojarra, I simply had to leave my xhtml files in their original locations, however I needed to place an empty file of the same name and relative path in the faces-views
directory. The filter seemed to recognize either extensionless or XHTML requests and display the page appropriately
When I switched to MyFaces however, this behavior changed where now the empty files in faces-views
directory were causing a Premature EOF Exception to be thrown on page request. I noticed that to be able to serve both XHTML and extensionless requests that I needed to keep duplicate copies of the same page in both places.
I tried to work around this by having the file in faces-views
do a and it found the source but the page wasn't loading correctly when I did this.
My question is, why am I seeing different behavior between Mojarra and MyFaces with ExtensionlessURLs? Could Spring Security by the reason for this? How can I work around this issue to where I do not need to keep two copies of the same source code in my project (clearly I am inviting silly errors and missed features by accepting this)?