incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r587481 - in /incubator/sling/whiteboard/microsling/src/main: java/org/apache/sling/microsling/servlet/ webapp/WEB-INF/
Date Tue, 23 Oct 2007 12:43:16 GMT
Author: bdelacretaz
Date: Tue Oct 23 05:43:15 2007
New Revision: 587481

URL: http://svn.apache.org/viewvc?rev=587481&view=rev
Log:
SLING-78 - Provide some extension hooks in MicroSlingServlet (also renamed it to MicroslingMainServlet)

Added:
    incubator/sling/whiteboard/microsling/src/main/java/org/apache/sling/microsling/servlet/MicroslingMainServlet.java
      - copied, changed from r587462, incubator/sling/whiteboard/microsling/src/main/java/org/apache/sling/microsling/servlet/MicroSlingServlet.java
Removed:
    incubator/sling/whiteboard/microsling/src/main/java/org/apache/sling/microsling/servlet/MicroSlingServlet.java
Modified:
    incubator/sling/whiteboard/microsling/src/main/java/org/apache/sling/microsling/servlet/MicroSlingFilterHelper.java
    incubator/sling/whiteboard/microsling/src/main/webapp/WEB-INF/web.xml

Modified: incubator/sling/whiteboard/microsling/src/main/java/org/apache/sling/microsling/servlet/MicroSlingFilterHelper.java
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/microsling/src/main/java/org/apache/sling/microsling/servlet/MicroSlingFilterHelper.java?rev=587481&r1=587480&r2=587481&view=diff
==============================================================================
--- incubator/sling/whiteboard/microsling/src/main/java/org/apache/sling/microsling/servlet/MicroSlingFilterHelper.java
(original)
+++ incubator/sling/whiteboard/microsling/src/main/java/org/apache/sling/microsling/servlet/MicroSlingFilterHelper.java
Tue Oct 23 05:43:15 2007
@@ -32,7 +32,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.sling.microsling.servlet.MicroSlingServlet;
+import org.apache.sling.microsling.servlet.MicroslingMainServlet;
 
 /** This is helper code, not very interesting to study (but it's
  *  not in an "helpers" package as that would require too much public
@@ -44,13 +44,13 @@
  */
 class MicroSlingFilterHelper {
 
-    private MicroSlingServlet microSling;
+    private MicroslingMainServlet microSling;
 
     private List<Filter> requestFilterList = new LinkedList<Filter>();
 
     private Filter[] requestFilters;
 
-    MicroSlingFilterHelper(MicroSlingServlet microSling) {
+    MicroSlingFilterHelper(MicroslingMainServlet microSling) {
         this.microSling = microSling;
     }
 
@@ -129,13 +129,13 @@
      */
     private static class MicroSlingFilterChain implements FilterChain {
 
-        private final MicroSlingServlet microSlingServlet;
+        private final MicroslingMainServlet microSlingServlet;
 
         private final Filter[] requestFilters;
 
         private int currentFilter;
 
-        private MicroSlingFilterChain(MicroSlingServlet microSlingServlet,
+        private MicroSlingFilterChain(MicroslingMainServlet microSlingServlet,
                 Filter[] requestFilters) {
             this.microSlingServlet = microSlingServlet;
             this.requestFilters = requestFilters;

Copied: incubator/sling/whiteboard/microsling/src/main/java/org/apache/sling/microsling/servlet/MicroslingMainServlet.java
(from r587462, incubator/sling/whiteboard/microsling/src/main/java/org/apache/sling/microsling/servlet/MicroSlingServlet.java)
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/microsling/src/main/java/org/apache/sling/microsling/servlet/MicroslingMainServlet.java?p2=incubator/sling/whiteboard/microsling/src/main/java/org/apache/sling/microsling/servlet/MicroslingMainServlet.java&p1=incubator/sling/whiteboard/microsling/src/main/java/org/apache/sling/microsling/servlet/MicroSlingServlet.java&r1=587462&r2=587481&rev=587481&view=diff
==============================================================================
--- incubator/sling/whiteboard/microsling/src/main/java/org/apache/sling/microsling/servlet/MicroSlingServlet.java
(original)
+++ incubator/sling/whiteboard/microsling/src/main/java/org/apache/sling/microsling/servlet/MicroslingMainServlet.java
Tue Oct 23 05:43:15 2007
@@ -53,7 +53,7 @@
  * MicroSlingFilterHelper, select and delegate to a SlingServlet to process the
  * request.
  */
-public class MicroSlingServlet extends GenericServlet {
+public class MicroslingMainServlet extends GenericServlet {
 
     private static final long serialVersionUID = 1L;
 
@@ -67,34 +67,41 @@
 
     private DefaultSlingServlet defaultSlingServlet;
     
-    private static final Logger log = LoggerFactory.getLogger(MicroSlingServlet.class);
+    private static final Logger log = LoggerFactory.getLogger(MicroslingMainServlet.class);
 
     @Override
     public void init() throws ServletException {
         super.init();
-
-        serviceLocator = new MicroslingServiceLocator();
-
-        // TODO use OSGi to setup this list
+        servlets = new HashMap<String, Servlet>();
+        initFilterChain();
+        initServlets();
+        initServiceLocator();
+        initScriptResolver();
+    }
+    
+    /** init our filter chain */
+    protected void initFilterChain() throws ServletException {
         filterChain = new MicroSlingFilterHelper(this);
         addFilter(new ResponseContentTypeResolverFilter());
-
-        // TODO use OSGi to setup this list
-        servlets = new HashMap<String, Servlet>();
-        
+    }
+    
+    /** init our servlets */
+    protected void initServlets() throws ServletException {
         // TODO use a utility class to map nt:file to the magic NODETYPES path 
         addServlet("NODETYPES/nt/file", new StreamServlet());
-
-        try {
-
-            scriptResolver = new SlingScriptResolver();
-            defaultSlingServlet = new DefaultSlingServlet();
-
-        } catch (Exception e) {
-            throw new ServletException("init() failed: " + e, e);
-        }
+        defaultSlingServlet = new DefaultSlingServlet();
     }
 
+    /** init our serviceLocator */
+    protected void initServiceLocator() throws ServletException {
+        serviceLocator = new MicroslingServiceLocator();
+    }
+    
+    /** init our scriptResolver */
+    protected void initScriptResolver() throws ServletException {
+        scriptResolver = new SlingScriptResolver();
+    }
+    
     /**
      * Execute our Filters via MicroSlingFilterHelper, which calls our doService
      * method after executing the filters
@@ -205,13 +212,13 @@
         try {
             ServletConfig config = new ServletConfig() {
                 public String getInitParameter(String name) {
-                    return MicroSlingServlet.this.getInitParameter(name);
+                    return MicroslingMainServlet.this.getInitParameter(name);
                 }
                 public Enumeration<?> getInitParameterNames() {
-                    return MicroSlingServlet.this.getInitParameterNames();
+                    return MicroslingMainServlet.this.getInitParameterNames();
                 }
                 public ServletContext getServletContext() {
-                    return MicroSlingServlet.this.getServletContext();
+                    return MicroslingMainServlet.this.getServletContext();
                 }
                 public String getServletName() {
                     return resourceType;

Modified: incubator/sling/whiteboard/microsling/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/microsling/src/main/webapp/WEB-INF/web.xml?rev=587481&r1=587480&r2=587481&view=diff
==============================================================================
--- incubator/sling/whiteboard/microsling/src/main/webapp/WEB-INF/web.xml (original)
+++ incubator/sling/whiteboard/microsling/src/main/webapp/WEB-INF/web.xml Tue Oct 23 05:43:15
2007
@@ -119,7 +119,7 @@
   <servlet>
     <servlet-name>Microsling</servlet-name>
     <description>Microsling support servlet</description>
-    <servlet-class>org.apache.sling.microsling.servlet.MicroSlingServlet</servlet-class>
+    <servlet-class>org.apache.sling.microsling.servlet.MicroslingMainServlet</servlet-class>
 
     <init-param>
       <param-name>container-encoding</param-name>



Mime
View raw message