Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325072 - Servlet 3.0 spec 9.3 include and missing files
Summary: Servlet 3.0 spec 9.3 include and missing files
Status: RESOLVED FIXED
Alias: None
Product: Jetty
Classification: RT
Component: server (show other bugs)
Version: 8.0.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 7.1.x   Edit
Assignee: Greg Wilkins CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-13 02:43 EDT by David Jencks CLA
Modified: 2010-09-14 02:14 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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