Revision: 1197
          http://stripes.svn.sourceforge.net/stripes/?rev=1197&view=rev
Author:   bengunter
Date:     2009-10-27 18:59:17 +0000 (Tue, 27 Oct 2009)

Log Message:
-----------
Applied fix for STS-715 from trunk

Modified Paths:
--------------
    
branches/1.5.x/stripes/src/net/sourceforge/stripes/controller/DynamicMappingFilter.java

Modified: 
branches/1.5.x/stripes/src/net/sourceforge/stripes/controller/DynamicMappingFilter.java
===================================================================
--- 
branches/1.5.x/stripes/src/net/sourceforge/stripes/controller/DynamicMappingFilter.java
     2009-10-27 18:54:40 UTC (rev 1196)
+++ 
branches/1.5.x/stripes/src/net/sourceforge/stripes/controller/DynamicMappingFilter.java
     2009-10-27 18:59:17 UTC (rev 1197)
@@ -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(R) 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/devconference
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to