incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r585099 - in /incubator/sling/whiteboard/microsling/src/main: java/org/apache/sling/microsling/slingservlets/VelocityTemplatesServlet.java webapp/velocity-scripts.html
Date Tue, 16 Oct 2007 10:29:13 GMT
Author: bdelacretaz
Date: Tue Oct 16 03:29:04 2007
New Revision: 585099

URL: http://svn.apache.org/viewvc?rev=585099&view=rev
Log:
SLING-57, adapt Velocity stuff to the modified Resource interface

Modified:
    incubator/sling/whiteboard/microsling/src/main/java/org/apache/sling/microsling/slingservlets/VelocityTemplatesServlet.java
    incubator/sling/whiteboard/microsling/src/main/webapp/velocity-scripts.html

Modified: incubator/sling/whiteboard/microsling/src/main/java/org/apache/sling/microsling/slingservlets/VelocityTemplatesServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/microsling/src/main/java/org/apache/sling/microsling/slingservlets/VelocityTemplatesServlet.java?rev=585099&r1=585098&r2=585099&view=diff
==============================================================================
--- incubator/sling/whiteboard/microsling/src/main/java/org/apache/sling/microsling/slingservlets/VelocityTemplatesServlet.java
(original)
+++ incubator/sling/whiteboard/microsling/src/main/java/org/apache/sling/microsling/slingservlets/VelocityTemplatesServlet.java
Tue Oct 16 03:29:04 2007
@@ -24,6 +24,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.sling.microsling.api.Resource;
 import org.apache.sling.microsling.etc.AbstractSlingServlet;
 import org.apache.sling.microsling.etc.HttpConstants;
 import org.apache.sling.microsling.requestcontext.SlingRequestContext;
@@ -72,8 +73,12 @@
         
         // initialize the Velocity context
         final VelocityContext c = new VelocityContext();
-        c.put("resource", ctx.getResource());
+        final Resource r =  ctx.getResource();
+        c.put("resource", r);
         c.put("slingContext", SlingRequestContext.getFromRequest(req));
+        if(r!=null && (r.getItem() instanceof Node)) {
+            c.put("node", (Node)r.getItem());
+        }
         
         // set the output content type
         final String fakeFilename = "fake." + ctx.getExtension();

Modified: incubator/sling/whiteboard/microsling/src/main/webapp/velocity-scripts.html
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/microsling/src/main/webapp/velocity-scripts.html?rev=585099&r1=585098&r2=585099&view=diff
==============================================================================
--- incubator/sling/whiteboard/microsling/src/main/webapp/velocity-scripts.html (original)
+++ incubator/sling/whiteboard/microsling/src/main/webapp/velocity-scripts.html Tue Oct 16
03:29:04 2007
@@ -48,9 +48,9 @@
   The current resource URI is <b>$resource.URI</b>
 </p>
 
-<h2>$resource.item.getProperty("title").getString()</h2>
+<h2>$node.getProperty("title").getString()</h2>
 <p>
-  $resource.item.getProperty("text").getString()
+  $node.getProperty("text").getString()
 </p>
 
 </body>



Mime
View raw message