Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 325072

Summary: Servlet 3.0 spec 9.3 include and missing files
Product: [RT] Jetty Reporter: David Jencks <david.a.jencks>
Component: serverAssignee: Greg Wilkins <gregw>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jetty-inbox, mgorovoy
Version: 8.0.0   
Target Milestone: 7.1.x   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description David Jencks CLA 2010-09-13 02:43:13 EDT
Last paragraph of section 9.3 indicates that the default servlet must, when content is missing and dispatch was an include, throw a FileNotFound exception.

This bit of patch to DefaultServlet (already patched for the content-length problem with filters) seems to fix the issue:

@@ -456,7 +458,11 @@
 
             // Handle resource
             if (resource==null || !resource.exists())
-                response.sendError(HttpServletResponse.SC_NOT_FOUND);
+                if (included) {
+                    throw new FileNotFoundException("Nothing at " + pathInContext);
+                } else {
+                    response.sendError(HttpServletResponse.SC_NOT_FOUND);
+                }
Comment 1 David Jencks CLA 2010-09-13 15:48:43 EDT
This paragraph in the servlet 3 spec was not in the 2.4 spec (section 8.3 there).  However I think this behavior might be useful in jetty 7 as well since currently trying to include a non-existent static resource fails with no notice to the including servlet.
Comment 2 David Jencks CLA 2010-09-14 01:42:45 EDT
fixed in jetty 7 (trunk) rev 2271
Comment 3 Greg Wilkins CLA 2010-09-14 02:14:06 EDT
fix looks good