You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:51:40 UTC

[sling-org-apache-sling-jcr-webdav] 05/07: SLING-2825 : sling webdav servlet should support config property "createAbsoluteURI" . Apply patch from Julian Reschke

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.2.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-webdav.git

commit c7d2fe5c39f16ab98c6ac19ff19cebb87d771af2
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu May 16 07:50:56 2013 +0000

    SLING-2825 :  sling webdav servlet should support config property "createAbsoluteURI" . Apply patch from Julian Reschke
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/webdav@1483223 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                                       |  3 +--
 .../sling/jcr/webdav/impl/helper/SlingResourceConfig.java     | 11 +++++++++--
 .../sling/jcr/webdav/impl/servlets/SlingWebDavServlet.java    |  5 +++++
 src/main/resources/OSGI-INF/metatype/metatype.properties      |  4 ++++
 4 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index e9d1bd0..bae7b79 100644
--- a/pom.xml
+++ b/pom.xml
@@ -51,7 +51,6 @@
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
-                <version>2.3.4</version>
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
@@ -116,7 +115,7 @@
         <dependency>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>jackrabbit-jcr-server</artifactId>
-            <version>2.4.2</version>
+            <version>2.4.4</version>
             <scope>compile</scope>
         </dependency>
 
diff --git a/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingResourceConfig.java b/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingResourceConfig.java
index eab6da0..b0e16da 100644
--- a/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingResourceConfig.java
+++ b/src/main/java/org/apache/sling/jcr/webdav/impl/helper/SlingResourceConfig.java
@@ -92,8 +92,15 @@ public class SlingResourceConfig extends ResourceConfig {
             config.get(SlingWebDavServlet.PROP_REALM),
             SlingWebDavServlet.DEFAULT_REALM);
         servletInitParams.put(
-            SimpleWebdavServlet.INIT_PARAM_AUTHENTICATE_HEADER,
-            "Basic realm=\"" + value + "\"");
+                SimpleWebdavServlet.INIT_PARAM_AUTHENTICATE_HEADER,
+                "Basic realm=\"" + value + "\"");
+
+        boolean createAbsoluteUri = OsgiUtil.toBoolean(
+            config.get(SlingWebDavServlet.PROP_CREATE_ABSOLUTE_URI),
+            SlingWebDavServlet.DEFAULT_CREATE_ABSOLUTE_URI);
+        servletInitParams.put(
+                SimpleWebdavServlet.INIT_PARAM_CREATE_ABSOLUTE_URI,
+                Boolean.toString(createAbsoluteUri));
     }
 
     // ---------- ResourceConfig overwrites
diff --git a/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SlingWebDavServlet.java b/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SlingWebDavServlet.java
index 2e70cb6..72c45bc 100644
--- a/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SlingWebDavServlet.java
+++ b/src/main/java/org/apache/sling/jcr/webdav/impl/servlets/SlingWebDavServlet.java
@@ -83,6 +83,11 @@ public class SlingWebDavServlet extends SimpleWebdavServlet {
     @Property(DEFAULT_CONTEXT)
     public static final String PROP_CONTEXT = "dav.root";
 
+    public static final boolean DEFAULT_CREATE_ABSOLUTE_URI = true;
+
+    @Property(boolValue=DEFAULT_CREATE_ABSOLUTE_URI)
+    public static final String PROP_CREATE_ABSOLUTE_URI = "dav.create-absolute-uri";
+
     public static final String DEFAULT_REALM = "Sling WebDAV";
 
     @Property(DEFAULT_REALM)
diff --git a/src/main/resources/OSGI-INF/metatype/metatype.properties b/src/main/resources/OSGI-INF/metatype/metatype.properties
index 78b4793..2a3cb41 100644
--- a/src/main/resources/OSGI-INF/metatype/metatype.properties
+++ b/src/main/resources/OSGI-INF/metatype/metatype.properties
@@ -69,6 +69,10 @@ dav.realm.description = The name of the HTTP Basic Authentication Realm \
  presented to the client to ask for authentication credentials to access the \
  repository.
 
+dav.create-absolute-uri.name = Use absolute URIs
+dav.create-absolute-uri.description = When set to true, create absolute URIs \
+ in WebDAV responses. Otherwise, use absolute paths. (See RFC 4918, Section 8.3)
+
 collection.types.name = Non Collection Node Types
 collection.types.description = The JCR Node Types considered being \
  non-collection resouces by WebDAV. Any node replying true to Node.isNodeType() \

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