incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jus...@apache.org
Subject svn commit: r1147307 - in /sling/trunk/maven/archetypes/servlet/src/main/resources/archetype-resources/src/main/java: ByPathServlet.java ByResourceTypeServlet.java
Date Fri, 15 Jul 2011 20:24:07 GMT
Author: justin
Date: Fri Jul 15 20:24:07 2011
New Revision: 1147307

URL: http://svn.apache.org/viewvc?rev=1147307&view=rev
Log:
SLING-2145 - switching to use @SlingServlet

Modified:
    sling/trunk/maven/archetypes/servlet/src/main/resources/archetype-resources/src/main/java/ByPathServlet.java
    sling/trunk/maven/archetypes/servlet/src/main/resources/archetype-resources/src/main/java/ByResourceTypeServlet.java

Modified: sling/trunk/maven/archetypes/servlet/src/main/resources/archetype-resources/src/main/java/ByPathServlet.java
URL: http://svn.apache.org/viewvc/sling/trunk/maven/archetypes/servlet/src/main/resources/archetype-resources/src/main/java/ByPathServlet.java?rev=1147307&r1=1147306&r2=1147307&view=diff
==============================================================================
--- sling/trunk/maven/archetypes/servlet/src/main/resources/archetype-resources/src/main/java/ByPathServlet.java
(original)
+++ sling/trunk/maven/archetypes/servlet/src/main/resources/archetype-resources/src/main/java/ByPathServlet.java
Fri Jul 15 20:24:07 2011
@@ -21,15 +21,11 @@ package ${package};
 import java.io.IOException;
 import java.io.Writer;
 
-import javax.servlet.Servlet;
 import javax.servlet.ServletException;
 
-import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Properties;
 import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
-
+import org.apache.felix.scr.annotations.sling.SlingServlet;
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.SlingHttpServletResponse;
 import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
@@ -38,13 +34,23 @@ import org.slf4j.LoggerFactory;
 
 /**
  * Hello World Servlet registered by path
+ * 
+ * Annotations below are short version of:
+ * 
+ * @Component
+ * @Service(Servlet.class)
+ * @Properties({
+ *     @Property(name="service.description", value="Hello World Path Servlet"),
+ *     @Property(name="service.vendor", value="The Apache Software Foundation"),
+ *     @Property(name="sling.servlet.paths", value="/hello-world-servlet")
+ * })
  */
-@Component
-@Service(Servlet.class)
-@Properties({ @Property(name="service.description", value="Hello World Path Servlet"),
-    @Property(name="service.vendor", value="The Apache Software Foundation"),
-    @Property(name="sling.servlet.paths", value="/hello-world-servlet")
+@SlingServlet(paths="/hello-world-servlet")
+@Properties({
+    @Property(name="service.description", value="Hello World Path Servlet"),
+    @Property(name="service.vendor", value="The Apache Software Foundation")
 })
+@SuppressWarnings("serial")
 public class ByPathServlet extends SlingSafeMethodsServlet {
     
     private final Logger log = LoggerFactory.getLogger(ByPathServlet.class);

Modified: sling/trunk/maven/archetypes/servlet/src/main/resources/archetype-resources/src/main/java/ByResourceTypeServlet.java
URL: http://svn.apache.org/viewvc/sling/trunk/maven/archetypes/servlet/src/main/resources/archetype-resources/src/main/java/ByResourceTypeServlet.java?rev=1147307&r1=1147306&r2=1147307&view=diff
==============================================================================
--- sling/trunk/maven/archetypes/servlet/src/main/resources/archetype-resources/src/main/java/ByResourceTypeServlet.java
(original)
+++ sling/trunk/maven/archetypes/servlet/src/main/resources/archetype-resources/src/main/java/ByResourceTypeServlet.java
Fri Jul 15 20:24:07 2011
@@ -21,15 +21,11 @@ package ${package};
 import java.io.IOException;
 import java.io.Writer;
 
-import javax.servlet.Servlet;
 import javax.servlet.ServletException;
 
-import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Properties;
 import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
-
+import org.apache.felix.scr.annotations.sling.SlingServlet;
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.SlingHttpServletResponse;
 import org.apache.sling.api.resource.Resource;
@@ -39,15 +35,25 @@ import org.slf4j.LoggerFactory;
 
 /**
  * Hello World Servlet registered by resource type
+ *
+ * Annotations below are short version of:
+ * 
+ * @Component
+ * @Service(Servlet.class)
+ * @Properties({
+ *    @Property(name="service.description", value="Hello World Type Servlet"),
+ *    @Property(name="service.vendor", value="The Apache Software Foundation"),
+ *    @Property(name="sling.servlet.resourceTypes", value="sling/servlet/default"),
+ *    @Property(name="sling.servlet.selectors", value="hello"),
+ *    @Property(name="sling.servlet.extensions", value="html")
+ * })
  */
-@Component
-@Service(Servlet.class)
-@Properties({ @Property(name="service.description", value="Hello World Type Servlet"),
-    @Property(name="service.vendor", value="The Apache Software Foundation"),
-    @Property(name = "sling.servlet.resourceTypes", value = "sling/servlet/default"),
-    @Property(name = "sling.servlet.selectors", value = "hello"),
-    @Property(name = "sling.servlet.extensions", value = "html")
+@SlingServlet(resourceTypes="sling/servlet/default", selectors="hello", extensions="html")
+@Properties({
+    @Property(name="service.description", value="Hello World Type Servlet"),
+    @Property(name="service.vendor", value="The Apache Software Foundation")
 })
+@SuppressWarnings("serial")
 public class ByResourceTypeServlet extends SlingSafeMethodsServlet {
     
     private final Logger log = LoggerFactory.getLogger(ByResourceTypeServlet.class);



Mime
View raw message