incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r600555 - in /incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard: FileServlet.java FolderServlet.java ReferenceServlet.java ResourceServlet.java
Date Mon, 03 Dec 2007 14:37:44 GMT
Author: fmeschbe
Date: Mon Dec  3 06:37:44 2007
New Revision: 600555

URL: http://svn.apache.org/viewvc?rev=600555&view=rev
Log:
SLING-109 Support Resource adapter

Modified:
    incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard/FileServlet.java
    incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard/FolderServlet.java
    incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard/ReferenceServlet.java
    incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard/ResourceServlet.java

Modified: incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard/FileServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard/FileServlet.java?rev=600555&r1=600554&r2=600555&view=diff
==============================================================================
--- incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard/FileServlet.java
(original)
+++ incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard/FileServlet.java
Mon Dec  3 06:37:44 2007
@@ -24,7 +24,6 @@
 import org.apache.sling.api.SlingException;
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.api.resource.ObjectProvider;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.servlets.SlingAllMethodsServlet;
 
@@ -46,7 +45,7 @@
             IOException {
 
         Resource resource = request.getResource();
-        FileObject file = (FileObject) ((ObjectProvider) resource).getObject();
+        FileObject file = resource.adaptTo(FileObject.class);
         if (file == null) {
             throw new SlingException("Missing mapped object for file "
                 + resource.getURI());

Modified: incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard/FolderServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard/FolderServlet.java?rev=600555&r1=600554&r2=600555&view=diff
==============================================================================
--- incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard/FolderServlet.java
(original)
+++ incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard/FolderServlet.java
Mon Dec  3 06:37:44 2007
@@ -25,7 +25,6 @@
 import org.apache.sling.api.SlingException;
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.api.resource.ObjectProvider;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.servlets.SlingAllMethodsServlet;
 
@@ -47,7 +46,7 @@
             IOException {
 
         Resource resource = request.getResource();
-        FolderObject content = (FolderObject) ((ObjectProvider) resource).getObject();
+        FolderObject content = resource.adaptTo(FolderObject.class);
         if (content == null) {
             throw new SlingException("Missing mapped object for folder "
                 + resource.getURI());

Modified: incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard/ReferenceServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard/ReferenceServlet.java?rev=600555&r1=600554&r2=600555&view=diff
==============================================================================
--- incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard/ReferenceServlet.java
(original)
+++ incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard/ReferenceServlet.java
Mon Dec  3 06:37:44 2007
@@ -24,7 +24,6 @@
 import org.apache.sling.api.SlingException;
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.api.resource.ObjectProvider;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.servlets.SlingAllMethodsServlet;
 
@@ -46,7 +45,7 @@
             IOException {
 
         final Resource resource = request.getResource();
-        final ReferenceObject content = (ReferenceObject) ((ObjectProvider) resource).getObject();
+        final ReferenceObject content = resource.adaptTo(ReferenceObject.class);
         final String path = content.getReference();
 
         // just forward to the referenced content

Modified: incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard/ResourceServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard/ResourceServlet.java?rev=600555&r1=600554&r2=600555&view=diff
==============================================================================
--- incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard/ResourceServlet.java
(original)
+++ incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard/ResourceServlet.java
Mon Dec  3 06:37:44 2007
@@ -25,10 +25,10 @@
 import java.io.OutputStream;
 
 import javax.jcr.RepositoryException;
+
 import org.apache.commons.io.IOUtils;
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.api.resource.ObjectProvider;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.servlets.SlingAllMethodsServlet;
 
@@ -49,7 +49,7 @@
             SlingHttpServletResponse response) throws IOException {
 
         Resource resource = request.getResource();
-        ResourceObject content = (ResourceObject) ((ObjectProvider) resource).getObject();
+        ResourceObject content = resource.adaptTo(ResourceObject.class);
 
         // check the last modification time and If-Modified-Since header
         long modifTime = content.getLastModificationTime();



Mime
View raw message