Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: Release 1.5.1
-
Fix Version/s: Release 1.5.2, Release 1.6
-
Component/s: ActionBean Dispatching
-
Labels:None
-
Environment:Probably the bug is platform independent, but it might be Glassfish-specific, I don't have resources to test it in other app servers
Description
Using code like
<s:url var="url" beanclass="package.MyAction" prependContext="false"/>
<jsp:include page="${url}"/>
when DynamicMappingFilter is used instead of ServletDispatcher, results in FileNotFoundException being thrown.
It is because ErrorTrappingResponseWrapper, as documented in line 343 comment "// Wrap the response in a wrapper that catches errors (but not exceptions)", does NOT catch any exceptions. When jsp:include is used to include an action URL instead a JSP file, the include request goes down to the default servlet which doesn't return SC_NOT_FOUND error code but throws a FileNotFoundException.
I have worked around the issue by changing
chain.doFilter(request, wrapper);
in DynamicMappingFilter.doFilter() method to
try { chain.doFilter(request, wrapper); } catch (FileNotFoundException fnfex) { fnfthrown = true; }
and manually overriding wrapper's errorCode to SC_NOT_FOUND in case the above exception is caught. I do not post entire patch because it's ugly and am hoping someone more knowledgeable with Stripes will be able to fix it better.
Hmm. I'm not sure this is a bug. I think it is higher up, i.e. why is a FileNotFoundException being thrown in the first place? The sample code from
the Stripes book uses DynamicMappingFilter instead of ServletDispatcher along with <s:url> and <jsp:include> to include an action, just like you described, and it works fine.
Any chance you could try it out with Tomcat? I know you said "I don't have resources to test it in other app servers" but Tomcat is free
And if by resources you mean time, well, if you don't have time to help out with the issue that you filed, then who does? 