sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1562505 - in /sling/trunk/contrib/extensions/feature-flags: pom.xml src/main/java/org/apache/sling/featureflags/impl/ExecutionContextImpl.java src/main/java/org/apache/sling/featureflags/impl/FeatureManager.java
Date Wed, 29 Jan 2014 16:38:09 GMT
Author: cziegeler
Date: Wed Jan 29 16:38:09 2014
New Revision: 1562505

URL: http://svn.apache.org/r1562505
Log:
SLING-3148 : Get resource resolver from authentication support via request attribute

Modified:
    sling/trunk/contrib/extensions/feature-flags/pom.xml
    sling/trunk/contrib/extensions/feature-flags/src/main/java/org/apache/sling/featureflags/impl/ExecutionContextImpl.java
    sling/trunk/contrib/extensions/feature-flags/src/main/java/org/apache/sling/featureflags/impl/FeatureManager.java

Modified: sling/trunk/contrib/extensions/feature-flags/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/feature-flags/pom.xml?rev=1562505&r1=1562504&r2=1562505&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/feature-flags/pom.xml (original)
+++ sling/trunk/contrib/extensions/feature-flags/pom.xml Wed Jan 29 16:38:09 2014
@@ -53,6 +53,12 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.auth.core</artifactId>
+            <version>1.1.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>servlet-api</artifactId>
         </dependency>

Modified: sling/trunk/contrib/extensions/feature-flags/src/main/java/org/apache/sling/featureflags/impl/ExecutionContextImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/feature-flags/src/main/java/org/apache/sling/featureflags/impl/ExecutionContextImpl.java?rev=1562505&r1=1562504&r2=1562505&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/feature-flags/src/main/java/org/apache/sling/featureflags/impl/ExecutionContextImpl.java
(original)
+++ sling/trunk/contrib/extensions/feature-flags/src/main/java/org/apache/sling/featureflags/impl/ExecutionContextImpl.java
Wed Jan 29 16:38:09 2014
@@ -22,6 +22,7 @@ import javax.servlet.http.HttpServletReq
 
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.auth.core.AuthenticationSupport;
 import org.apache.sling.featureflags.ExecutionContext;
 
 /**
@@ -40,9 +41,18 @@ public class ExecutionContextImpl implem
 
     public ExecutionContextImpl(final HttpServletRequest request) {
         this.request = request;
-        this.resourceResolver = (request instanceof SlingHttpServletRequest)
+        ResourceResolver resolver = (request instanceof SlingHttpServletRequest)
                 ? ((SlingHttpServletRequest) request).getResourceResolver()
                 : null;
+        if ( resolver == null ) {
+            // get ResourceResolver (set by AuthenticationSupport)
+            final Object resolverObject = request.getAttribute(AuthenticationSupport.REQUEST_ATTRIBUTE_RESOLVER);
+            resolver = (resolverObject instanceof ResourceResolver)
+                    ? (ResourceResolver) resolverObject
+                    : null;
+
+        }
+        this.resourceResolver = resolver;
     }
 
     @Override

Modified: sling/trunk/contrib/extensions/feature-flags/src/main/java/org/apache/sling/featureflags/impl/FeatureManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/feature-flags/src/main/java/org/apache/sling/featureflags/impl/FeatureManager.java?rev=1562505&r1=1562504&r2=1562505&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/feature-flags/src/main/java/org/apache/sling/featureflags/impl/FeatureManager.java
(original)
+++ sling/trunk/contrib/extensions/feature-flags/src/main/java/org/apache/sling/featureflags/impl/FeatureManager.java
Wed Jan 29 16:38:09 2014
@@ -105,13 +105,6 @@ public class FeatureManager {
                     put("service.ranking", Integer.MIN_VALUE);
                 }
             }));
-        services.add(bundleContext.registerService(Filter.class.getName(), new CurrentClientContextFilter(this),
-            new Hashtable<String, Object>() {
-            {
-                put("sling.filter.scope", "REQUEST");
-                put("service.ranking", Integer.MIN_VALUE);
-            }
-        }));
         this.services = services;
     }
 



Mime
View raw message