incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r825500 - /sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/filter/AbstractSlingFilterChain.java
Date Thu, 15 Oct 2009 14:07:31 GMT
Author: fmeschbe
Date: Thu Oct 15 14:07:31 2009
New Revision: 825500

URL: http://svn.apache.org/viewvc?rev=825500&view=rev
Log:
SLING-1003 Ensure request and response objects are Sling types before
calling the next filter or getting out of the chain

Modified:
    sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/filter/AbstractSlingFilterChain.java

Modified: sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/filter/AbstractSlingFilterChain.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/filter/AbstractSlingFilterChain.java?rev=825500&r1=825499&r2=825500&view=diff
==============================================================================
--- sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/filter/AbstractSlingFilterChain.java
(original)
+++ sling/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/filter/AbstractSlingFilterChain.java
Thu Oct 15 14:07:31 2009
@@ -46,20 +46,21 @@
             throws ServletException, IOException {
         this.current++;
 
+        // the previous filter may have wrapped non-Sling request and response
+        // wrappers (e.g. WebCastellum does this), so we have to make
+        // sure the request and response are Sling types again
+        SlingHttpServletRequest slingRequest = toSlingRequest(request);
+        SlingHttpServletResponse slingResponse = toSlingResponse(response);
+
         if (this.current < this.filters.length) {
 
             // continue filtering with the next filter
             Filter filter = this.filters[this.current];
-            trackFilter(request, filter);
-            filter.doFilter(request, response, this);
+            trackFilter(slingRequest, filter);
+            filter.doFilter(slingRequest, slingResponse, this);
 
         } else {
 
-            // end of chain, a filter may have wrapped a plain ServletRequest
-            // and we must ensure it is a Sling request again
-            SlingHttpServletRequest slingRequest = toSlingRequest(request);
-            SlingHttpServletResponse slingResponse = toSlingResponse(response);
-
             this.render(slingRequest, slingResponse);
 
         }



Mime
View raw message