Author: jvazquez
Date: Tue Feb 10 13:20:56 2009
New Revision: 742960

URL: http://svn.apache.org/viewvc?rev=742960&view=rev
Log:
Using resource.adaptTo(Map.class) to get the properties

Modified:
    
incubator/sling/whiteboard/jvazquez/pipeline/src/main/java/org/apache/sling/pipeline/prototype/PipelineServlet.java

Modified: 
incubator/sling/whiteboard/jvazquez/pipeline/src/main/java/org/apache/sling/pipeline/prototype/PipelineServlet.java
URL: 
http://svn.apache.org/viewvc/incubator/sling/whiteboard/jvazquez/pipeline/src/main/java/org/apache/sling/pipeline/prototype/PipelineServlet.java?rev=742960&r1=742959&r2=742960&view=diff
==============================================================================
--- 
incubator/sling/whiteboard/jvazquez/pipeline/src/main/java/org/apache/sling/pipeline/prototype/PipelineServlet.java
 (original)
+++ 
incubator/sling/whiteboard/jvazquez/pipeline/src/main/java/org/apache/sling/pipeline/prototype/PipelineServlet.java
 Tue Feb 10 13:20:56 2009
@@ -21,9 +21,8 @@
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.Map;
 
-import javax.jcr.Node;
-import javax.jcr.RepositoryException;
 import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -62,15 +61,17 @@
        private static final String PIPELINE_GENERATOR_PROP = "sling:generator";
        private static final String PIPELINE_TRANSFORM_PROP = "sling:transform";
        
+       @SuppressWarnings("unchecked")
        @Override
        protected void doGet(SlingHttpServletRequest request, 
SlingHttpServletResponse response) throws ServletException, IOException {
                try {
-                       // Supports only JCR resources
-                       Node currentNode = 
request.getResource().adaptTo(Node.class);
+                       
+                       // Node´s properties
+                       Map nodeProps = 
request.getResource().adaptTo(Map.class);
                        
                        // Generator and Transform properties 
-                       String generatorUrl = getGenUrl(currentNode);
-                       String[] transformUrls = getTranUrls(currentNode);
+                       String generatorUrl = 
nodeProps.get(PIPELINE_GENERATOR_PROP).toString();
+                       String[] transformUrls = 
nodeProps.get(PIPELINE_TRANSFORM_PROP).toString().split(";");
                        
                        // Builds the resources´ URLs 
                        URL srcUrl = buildAbsUrl(request, generatorUrl);
@@ -110,11 +111,4 @@
                return new URL(request.getScheme(), request.getServerName(), 
request.getServerPort(), relUrl);
        }
        
-       private String getGenUrl(Node node) throws RepositoryException {
-               return 
node.getProperty(PIPELINE_GENERATOR_PROP).getValue().getString();
-       }
-       
-       private String[] getTranUrls(Node node) throws RepositoryException {
-               return 
node.getProperty(PIPELINE_TRANSFORM_PROP).getValue().getString().split(";");
-       }
 }


Reply via email to