sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r654446 - /incubator/sling/trunk/sling/servlets-get/src/main/java/org/apache/sling/servlets/DefaultGetServlet.java
Date Thu, 08 May 2008 08:34:18 GMT
Author: fmeschbe
Date: Thu May  8 01:34:18 2008
New Revision: 654446

URL: http://svn.apache.org/viewvc?rev=654446&view=rev
Log:
Throw ResourceNotFoundException instead of sending 404 itself if the request
resource is a non existing resource

Modified:
    incubator/sling/trunk/sling/servlets-get/src/main/java/org/apache/sling/servlets/DefaultGetServlet.java

Modified: incubator/sling/trunk/sling/servlets-get/src/main/java/org/apache/sling/servlets/DefaultGetServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlets-get/src/main/java/org/apache/sling/servlets/DefaultGetServlet.java?rev=654446&r1=654445&r2=654446&view=diff
==============================================================================
--- incubator/sling/trunk/sling/servlets-get/src/main/java/org/apache/sling/servlets/DefaultGetServlet.java
(original)
+++ incubator/sling/trunk/sling/servlets-get/src/main/java/org/apache/sling/servlets/DefaultGetServlet.java
Thu May  8 01:34:18 2008
@@ -26,6 +26,7 @@
 
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.SlingHttpServletResponse;
+import org.apache.sling.api.resource.ResourceNotFoundException;
 import org.apache.sling.api.resource.ResourceUtil;
 import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
 import org.apache.sling.servlets.helpers.HtmlRendererServlet;
@@ -76,6 +77,10 @@
         streamerServlet = rendererMap.get(StreamRendererServlet.EXT_RES);
     }
 
+    /**
+     * @throws ResourceNotFoundException if the resource of the request is a non
+     *             existing resource.
+     */
     @Override
     protected void doGet(SlingHttpServletRequest request,
             SlingHttpServletResponse response) throws ServletException,
@@ -83,9 +88,8 @@
 
         // cannot handle the request for missing resources
         if (ResourceUtil.isNonExistingResource(request.getResource())) {
-            response.sendError(HttpServletResponse.SC_NOT_FOUND,
-                "Resource not found at path " + request.getResource().getPath());
-            return;
+            throw new ResourceNotFoundException(
+                request.getResource().getPath(), "No Resource found");
         }
 
         Servlet rendererServlet;



Mime
View raw message