incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1086978 - in /sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl: SlingRequestProcessorImpl.java request/RequestData.java
Date Wed, 30 Mar 2011 15:01:40 GMT
Author: cziegeler
Date: Wed Mar 30 15:01:39 2011
New Revision: 1086978

URL: http://svn.apache.org/viewvc?rev=1086978&view=rev
Log:
SLING-2040 : Avoid logger instantiation and extra servlet resolver null check in RequestData

Modified:
    sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java
    sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/request/RequestData.java

Modified: sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java?rev=1086978&r1=1086977&r2=1086978&view=diff
==============================================================================
--- sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java
(original)
+++ sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java
Wed Mar 30 15:01:39 2011
@@ -139,16 +139,18 @@ public class SlingRequestProcessorImpl i
         }
 
         try {
+            final ServletResolver sr = this.servletResolver;
+
             // check that we have all required services
             if (resourceResolver == null) {
                 throw new UnavailableException("ResourceResolver");
-            } else if (servletResolver == null) {
+            } else if (sr == null) {
                 throw new UnavailableException("ServletResolver");
             }
 
             // initialize the request data - resolve resource and servlet
             Resource resource = requestData.initResource(resourceResolver);
-            requestData.initServlet(resource);
+            requestData.initServlet(resource, sr);
 
             Filter[] filters = filterManager.getFilters(FilterChainType.REQUEST);
             if (filters != null) {
@@ -311,10 +313,6 @@ public class SlingRequestProcessorImpl i
         }
     }
 
-    public ServletResolver getServletResolver() {
-        return servletResolver;
-    }
-
     // ---------- Error Handling with Filters
 
     void handleError(final int status, final String message,

Modified: sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/request/RequestData.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/request/RequestData.java?rev=1086978&r1=1086977&r2=1086978&view=diff
==============================================================================
--- sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/request/RequestData.java
(original)
+++ sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/request/RequestData.java
Wed Mar 30 15:01:39 2011
@@ -55,8 +55,6 @@ import org.apache.sling.engine.impl.Slin
 import org.apache.sling.engine.impl.adapter.SlingServletRequestAdapter;
 import org.apache.sling.engine.impl.adapter.SlingServletResponseAdapter;
 import org.apache.sling.engine.impl.parameters.ParameterSupport;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * The <code>RequestData</code> class provides access to objects which are set
@@ -73,9 +71,6 @@ import org.slf4j.LoggerFactory;
  */
 public class RequestData {
 
-    /** default log */
-    private final Logger log = LoggerFactory.getLogger(RequestData.class);
-
     /**
      * The default value for the number of recursive inclusions for a single
      * instance of this class (value is 50).
@@ -203,7 +198,8 @@ public class RequestData {
         return resource;
     }
 
-    public void initServlet(final Resource resource) {
+    public void initServlet(final Resource resource,
+            final ServletResolver sr) {
         // the resource and the request path info, will never be null
         RequestPathInfo requestPathInfo = new SlingRequestPathInfo(resource);
         ContentData contentData = pushContent(resource, requestPathInfo);
@@ -211,17 +207,12 @@ public class RequestData {
 	    requestProgressTracker.log("Resource Path Info: {0}", requestPathInfo);
 
         // finally resolve the servlet for the resource
-        ServletResolver sr = slingRequestProcessor.getServletResolver();
-        if (sr != null) {
-            requestProgressTracker.startTimer("ServletResolution");
-            Servlet servlet = sr.resolveServlet(slingRequest);
-            requestProgressTracker.logTimer("ServletResolution",
-                "URI={0} handled by Servlet={1}",
-                getServletRequest().getRequestURI(), RequestUtil.getServletName(servlet));
-            contentData.setServlet(servlet);
-        } else {
-            log.warn("init(): No ServletResolver available");
-        }
+        requestProgressTracker.startTimer("ServletResolution");
+        Servlet servlet = sr.resolveServlet(slingRequest);
+        requestProgressTracker.logTimer("ServletResolution",
+            "URI={0} handled by Servlet={1}",
+            getServletRequest().getRequestURI(), RequestUtil.getServletName(servlet));
+        contentData.setServlet(servlet);
     }
 
     public void dispose() {



Mime
View raw message