sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1764477 - in /sling/trunk/contrib/extensions/startup-filter/src: main/java/org/apache/sling/startupfilter/impl/StartupFilterImpl.java test/java/org/apache/sling/startupfilter/impl/StartupFilterImplTest.java
Date Wed, 12 Oct 2016 14:49:27 GMT
Author: cziegeler
Date: Wed Oct 12 14:49:27 2016
New Revision: 1764477

URL: http://svn.apache.org/viewvc?rev=1764477&view=rev
Log:
SLING-6141 : StartupFilter should use servlet path and request info

Modified:
    sling/trunk/contrib/extensions/startup-filter/src/main/java/org/apache/sling/startupfilter/impl/StartupFilterImpl.java
    sling/trunk/contrib/extensions/startup-filter/src/test/java/org/apache/sling/startupfilter/impl/StartupFilterImplTest.java

Modified: sling/trunk/contrib/extensions/startup-filter/src/main/java/org/apache/sling/startupfilter/impl/StartupFilterImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/startup-filter/src/main/java/org/apache/sling/startupfilter/impl/StartupFilterImpl.java?rev=1764477&r1=1764476&r2=1764477&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/startup-filter/src/main/java/org/apache/sling/startupfilter/impl/StartupFilterImpl.java
(original)
+++ sling/trunk/contrib/extensions/startup-filter/src/main/java/org/apache/sling/startupfilter/impl/StartupFilterImpl.java
Wed Oct 12 14:49:27 2016
@@ -100,9 +100,10 @@ public class StartupFilterImpl implement
 
         // Bypass for the managerRoot path
         if(request instanceof HttpServletRequest) {
-            final String pathInfo = ((HttpServletRequest)request).getPathInfo();
-            if(managerRoot != null && managerRoot.length() > 0 && pathInfo
!= null && pathInfo.startsWith(managerRoot)) {
-                log.debug("Bypassing filter for path {} which starts with {}", pathInfo,
managerRoot);
+            final HttpServletRequest req = (HttpServletRequest)request;
+            final String path = req.getServletPath() + (req.getPathInfo() == null ? "" :
req.getPathInfo());
+            if (managerRoot != null && managerRoot.length() > 0 && path.startsWith(managerRoot))
{
+                log.debug("Bypassing filter for path {} which starts with {}", path, managerRoot);
                 chain.doFilter(request, sr);
                 return;
             }

Modified: sling/trunk/contrib/extensions/startup-filter/src/test/java/org/apache/sling/startupfilter/impl/StartupFilterImplTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/startup-filter/src/test/java/org/apache/sling/startupfilter/impl/StartupFilterImplTest.java?rev=1764477&r1=1764476&r2=1764477&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/startup-filter/src/test/java/org/apache/sling/startupfilter/impl/StartupFilterImplTest.java
(original)
+++ sling/trunk/contrib/extensions/startup-filter/src/test/java/org/apache/sling/startupfilter/impl/StartupFilterImplTest.java
Wed Oct 12 14:49:27 2016
@@ -202,6 +202,9 @@ public class StartupFilterImplTest {
             allowing(serviceRegistration).unregister();
             will(new ChangeInteger(activeFilterCount, false));
 
+            allowing(request).getServletPath();
+            will(returnValue(""));
+
             allowing(request).getPathInfo();
             will(returnValue(getPathInfo()));
 
@@ -211,10 +214,6 @@ public class StartupFilterImplTest {
         filter.setup(bundleContext, props);
     }
 
-    private String getRequestPath() {
-        return requestPath;
-    }
-
     private String getPathInfo() {
         return pathInfo;
     }



Mime
View raw message