incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r889421 - in /sling/trunk/bundles/servlets/get/src/main/java/org/apache/sling/servlets/get/impl: DefaultHeadServlet.java RedirectServlet.java
Date Thu, 10 Dec 2009 20:52:08 GMT
Author: fmeschbe
Date: Thu Dec 10 20:52:07 2009
New Revision: 889421

URL: http://svn.apache.org/viewvc?rev=889421&view=rev
Log:
Improved logging if response is committed or request included 

Modified:
    sling/trunk/bundles/servlets/get/src/main/java/org/apache/sling/servlets/get/impl/DefaultHeadServlet.java
    sling/trunk/bundles/servlets/get/src/main/java/org/apache/sling/servlets/get/impl/RedirectServlet.java

Modified: sling/trunk/bundles/servlets/get/src/main/java/org/apache/sling/servlets/get/impl/DefaultHeadServlet.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/get/src/main/java/org/apache/sling/servlets/get/impl/DefaultHeadServlet.java?rev=889421&r1=889420&r2=889421&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/get/src/main/java/org/apache/sling/servlets/get/impl/DefaultHeadServlet.java
(original)
+++ sling/trunk/bundles/servlets/get/src/main/java/org/apache/sling/servlets/get/impl/DefaultHeadServlet.java
Thu Dec 10 20:52:07 2009
@@ -32,6 +32,8 @@
 import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
 import org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper;
 import org.apache.sling.api.wrappers.SlingHttpServletResponseWrapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * The <code>DefaultHeadServlet</code> class implements default support for the
@@ -55,6 +57,9 @@
 
     private static final long serialVersionUID = 7416222678552027044L;
 
+    /** default log */
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
     @Override
     protected void doHead(SlingHttpServletRequest request,
             SlingHttpServletResponse response) throws ServletException,
@@ -62,8 +67,17 @@
 
         // don't do nothing if the request has already been committed
         // or this servlet is called for a servlet include
-        if (response.isCommitted()
-            || request.getAttribute(SlingConstants.ATTR_REQUEST_SERVLET) != null) {
+        if (response.isCommitted()) {
+            // committed response cannot be redirected
+            log.warn("DefaultHeadServlet: Ignoring request because response is committed");
+            request.getRequestProgressTracker().log(
+                "DefaultHeadServlet: Ignoring request because response is committed");
+            return;
+        } else if (request.getAttribute(SlingConstants.ATTR_REQUEST_SERVLET) != null) {
+            // included request will not redirect
+            log.warn("DefaultHeadServlet: Ignoring request because request is included");
+            request.getRequestProgressTracker().log(
+                "DefaultHeadServlet: Ignoring request because request is included");
             return;
         }
 

Modified: sling/trunk/bundles/servlets/get/src/main/java/org/apache/sling/servlets/get/impl/RedirectServlet.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/get/src/main/java/org/apache/sling/servlets/get/impl/RedirectServlet.java?rev=889421&r1=889420&r2=889421&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/get/src/main/java/org/apache/sling/servlets/get/impl/RedirectServlet.java
(original)
+++ sling/trunk/bundles/servlets/get/src/main/java/org/apache/sling/servlets/get/impl/RedirectServlet.java
Thu Dec 10 20:52:07 2009
@@ -85,11 +85,15 @@
         // check for redirectability
         if (response.isCommitted()) {
             // committed response cannot be redirected
-            log.warn("doGet: Response is already committed, not redirecting");
+            log.warn("RedirectServlet: Response is already committed, not redirecting");
+            request.getRequestProgressTracker().log(
+                "RedirectServlet: Response is already committed, not redirecting");
             return;
         } else if (request.getAttribute(SlingConstants.ATTR_REQUEST_SERVLET) != null) {
             // included request will not redirect
-            log.warn("doGet: Servlet is included, not redirecting");
+            log.warn("RedirectServlet: Servlet is included, not redirecting");
+            request.getRequestProgressTracker().log(
+                "RedirectServlet: Servlet is included, not redirecting");
             return;
         }
 



Mime
View raw message