sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r654210 - in /incubator/sling/trunk/sling/servlets-get/src/main/java/org/apache/sling/servlets: DefaultGetServlet.java helpers/StreamRendererServlet.java
Date Wed, 07 May 2008 18:50:41 GMT
Author: fmeschbe
Date: Wed May  7 11:50:40 2008
New Revision: 654210

URL: http://svn.apache.org/viewvc?rev=654210&view=rev
Log:
SLING-434 Move check for non existing resource to the DefaultGetServlet

Modified:
    incubator/sling/trunk/sling/servlets-get/src/main/java/org/apache/sling/servlets/DefaultGetServlet.java
    incubator/sling/trunk/sling/servlets-get/src/main/java/org/apache/sling/servlets/helpers/StreamRendererServlet.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=654210&r1=654209&r2=654210&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
Wed May  7 11:50:40 2008
@@ -26,6 +26,7 @@
 
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.SlingHttpServletResponse;
+import org.apache.sling.api.resource.ResourceUtil;
 import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
 import org.apache.sling.servlets.helpers.HtmlRendererServlet;
 import org.apache.sling.servlets.helpers.JsonRendererServlet;
@@ -80,6 +81,13 @@
             SlingHttpServletResponse response) throws ServletException,
             IOException {
 
+        // 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;
+        }
+
         Servlet rendererServlet;
         String ext = request.getRequestPathInfo().getExtension();
         if (ext == null) {

Modified: incubator/sling/trunk/sling/servlets-get/src/main/java/org/apache/sling/servlets/helpers/StreamRendererServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlets-get/src/main/java/org/apache/sling/servlets/helpers/StreamRendererServlet.java?rev=654210&r1=654209&r2=654210&view=diff
==============================================================================
--- incubator/sling/trunk/sling/servlets-get/src/main/java/org/apache/sling/servlets/helpers/StreamRendererServlet.java
(original)
+++ incubator/sling/trunk/sling/servlets-get/src/main/java/org/apache/sling/servlets/helpers/StreamRendererServlet.java
Wed May  7 11:50:40 2008
@@ -30,7 +30,6 @@
 
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.api.resource.NonExistingResource;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceMetadata;
 
@@ -61,13 +60,6 @@
 
         Resource resource = request.getResource();
 
-        // cannot handle the request for missing resources
-        if (resource instanceof NonExistingResource) {
-            response.sendError(HttpServletResponse.SC_NOT_FOUND,
-                "Resource not found at path " + resource.getPath());
-            return;
-        }
-
         // check the last modification time and If-Modified-Since header
         ResourceMetadata meta = resource.getResourceMetadata();
         long modifTime = meta.getModificationTime();



Mime
View raw message