This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.webdav-2.1.0
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-webdav.git

commit a91b18551878b8c5b47192a65794c8dd3a708d94
Author: Justin Edelson <jus...@apache.org>
AuthorDate: Mon Aug 16 14:13:25 2010 +0000

    SLING-1654 - using ResourceResolver.adaptTo(Session.class) to get the 
Session instead of getting the session directly as a request attribute
    
    git-svn-id: 
https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/webdav@985944 
13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                                      | 12 ++++++++++++
 .../sling/jcr/webdav/impl/helper/SlingSessionProvider.java   | 10 +++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index d4ba95a..6989c69 100644
--- a/pom.xml
+++ b/pom.xml
@@ -145,5 +145,17 @@
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.compendium</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.auth.core</artifactId>
+            <version>0.9.0-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.api</artifactId>
+            <version>2.0.8</version>
+            <scope>provided</scope>
+        </dependency>
     </dependencies>
 </project>
diff --git 
a/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingSessionProvider.java
 
b/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingSessionProvider.java
index 771f2d5..aacefa0 100644
--- 
a/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingSessionProvider.java
+++ 
b/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingSessionProvider.java
@@ -24,6 +24,8 @@ import javax.jcr.Session;
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.jackrabbit.server.SessionProvider;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.auth.core.AuthenticationSupport;
 
 /**
  * The <code>SlingSessionProvider</code> is a Jackrabbit WebDAV server
@@ -62,7 +64,13 @@ public class SlingSessionProvider implements SessionProvider 
{
         }
 
         // otherwise return the session from the request attribute
-        return (Session) request.getAttribute(ATTR_SESSION_NAME);
+        ResourceResolver resourceResolver = (ResourceResolver) 
+            
request.getAttribute(AuthenticationSupport.REQUEST_ATTRIBUTE_RESOLVER);
+        
+        if (resourceResolver == null) {
+            return null;
+        }
+        return resourceResolver.adaptTo(Session.class);
     }
 
     /**

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <commits@sling.apache.org>.

Reply via email to