Revision: 1150
          http://stripes.svn.sourceforge.net/stripes/?rev=1150&view=rev
Author:   fdaoud
Date:     2009-09-26 02:23:35 +0000 (Sat, 26 Sep 2009)

Log Message:
-----------
Fix for STS-715

Modified Paths:
--------------
    
trunk/stripes/src/net/sourceforge/stripes/controller/DynamicMappingFilter.java

Modified: 
trunk/stripes/src/net/sourceforge/stripes/controller/DynamicMappingFilter.java
===================================================================
--- 
trunk/stripes/src/net/sourceforge/stripes/controller/DynamicMappingFilter.java  
    2009-09-23 20:42:58 UTC (rev 1149)
+++ 
trunk/stripes/src/net/sourceforge/stripes/controller/DynamicMappingFilter.java  
    2009-09-26 02:23:35 UTC (rev 1150)
@@ -14,6 +14,7 @@
  */
 package net.sourceforge.stripes.controller;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.StringWriter;
@@ -343,11 +344,20 @@
         final ErrorTrappingResponseWrapper wrapper = new 
ErrorTrappingResponseWrapper(
                 (HttpServletResponse) response);
         
wrapper.setInclude(request.getAttribute(StripesConstants.REQ_ATTR_INCLUDE_PATH) 
!= null);
-        chain.doFilter(request, wrapper);
 
-        // If a SC_NOT_FOUND error occurred, then try to match an ActionBean 
to the URL
+        // Catch FileNotFoundException, which some containers (e.g. GlassFish) 
throw instead of setting SC_NOT_FOUND
+        boolean fileNotFoundExceptionThrown = false;
+
+        try {
+          chain.doFilter(request, wrapper);
+        }
+        catch (FileNotFoundException exc) {
+          fileNotFoundExceptionThrown = true;
+        }
+
+        // If a FileNotFoundException or SC_NOT_FOUND error occurred, then try 
to match an ActionBean to the URL
         Integer errorCode = wrapper.getErrorCode();
-        if (errorCode != null && errorCode == 
HttpServletResponse.SC_NOT_FOUND) {
+        if ((errorCode != null && errorCode == 
HttpServletResponse.SC_NOT_FOUND) || fileNotFoundExceptionThrown) {
             stripesFilter.doFilter(request, response, new FilterChain() {
                 public void doFilter(ServletRequest request, ServletResponse 
response)
                         throws IOException, ServletException {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to