jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r1515677 - in /jackrabbit/commons/filevault/trunk: vault-cli/src/main/java/org/apache/jackrabbit/vault/cli/extended/ vault-davex/src/main/java/org/apache/jackrabbit/vault/davex/
Date Tue, 20 Aug 2013 00:15:02 GMT
Author: tripod
Date: Tue Aug 20 00:15:01 2013
New Revision: 1515677

URL: http://svn.apache.org/r1515677
Log:
JCR-3650 vlt: DavException when checkout against jackrabbit standalone

Modified:
    jackrabbit/commons/filevault/trunk/vault-cli/src/main/java/org/apache/jackrabbit/vault/cli/extended/ExtendedOption.java
    jackrabbit/commons/filevault/trunk/vault-cli/src/main/java/org/apache/jackrabbit/vault/cli/extended/XDavEx.java
    jackrabbit/commons/filevault/trunk/vault-davex/src/main/java/org/apache/jackrabbit/vault/davex/DAVExRepositoryFactory.java

Modified: jackrabbit/commons/filevault/trunk/vault-cli/src/main/java/org/apache/jackrabbit/vault/cli/extended/ExtendedOption.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-cli/src/main/java/org/apache/jackrabbit/vault/cli/extended/ExtendedOption.java?rev=1515677&r1=1515676&r2=1515677&view=diff
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-cli/src/main/java/org/apache/jackrabbit/vault/cli/extended/ExtendedOption.java
(original)
+++ jackrabbit/commons/filevault/trunk/vault-cli/src/main/java/org/apache/jackrabbit/vault/cli/extended/ExtendedOption.java
Tue Aug 20 00:15:01 2013
@@ -43,7 +43,7 @@ abstract public class ExtendedOption imp
     public void process(String args) {
         // currently just split the args
         for (String nvp: Text.explode(args, ',')) {
-            String[] nv = Text.explode(nvp, '=');
+            String[] nv = Text.explode(nvp, '=', true);
             String name = nv[0].trim();
             String value = nv.length > 1 ? nv[1].trim() : "true";
             System.setProperty(getSystemPrefix() + name, value);

Modified: jackrabbit/commons/filevault/trunk/vault-cli/src/main/java/org/apache/jackrabbit/vault/cli/extended/XDavEx.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-cli/src/main/java/org/apache/jackrabbit/vault/cli/extended/XDavEx.java?rev=1515677&r1=1515676&r2=1515677&view=diff
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-cli/src/main/java/org/apache/jackrabbit/vault/cli/extended/XDavEx.java
(original)
+++ jackrabbit/commons/filevault/trunk/vault-cli/src/main/java/org/apache/jackrabbit/vault/cli/extended/XDavEx.java
Tue Aug 20 00:15:01 2013
@@ -50,7 +50,9 @@ public class XDavEx extends ExtendedOpti
     }
 
     public String getExample() {
-        return "-Xdavex:depth=2,spilog=my.log";
+        return "Set depth to 2 and specify a log: -Xdavex:depth=2,spilog=my.log\n" +
+               "     Set an empty referer header: -Xdavex:referer=,depth=2\n" +
+               "   Set a specific referer header: -Xdavex:referer=http://my.server.com";
     }
 
     public boolean hasName(String s) {
@@ -76,11 +78,17 @@ public class XDavEx extends ExtendedOpti
                                 .withMaximum(1)
                                 .create())
                         .withOption(new ArgumentBuilder()
-                                .withName("depth")
+                                .withName("depth=<n>")
                                 .withDescription("retrieval depth. default 4")
                                 .withMinimum(1)
                                 .withMaximum(1)
                                 .create())
+                        .withOption(new ArgumentBuilder()
+                                .withName("referer=<header>")
+                                .withDescription("HTTP Referer header to use for the requests.
default is http://localhost/")
+                                .withMinimum(1)
+                                .withMaximum(1)
+                                .create())
                         .create()
                 )
                 .create();

Modified: jackrabbit/commons/filevault/trunk/vault-davex/src/main/java/org/apache/jackrabbit/vault/davex/DAVExRepositoryFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-davex/src/main/java/org/apache/jackrabbit/vault/davex/DAVExRepositoryFactory.java?rev=1515677&r1=1515676&r2=1515677&view=diff
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-davex/src/main/java/org/apache/jackrabbit/vault/davex/DAVExRepositoryFactory.java
(original)
+++ jackrabbit/commons/filevault/trunk/vault-davex/src/main/java/org/apache/jackrabbit/vault/davex/DAVExRepositoryFactory.java
Tue Aug 20 00:15:01 2013
@@ -65,6 +65,11 @@ public class DAVExRepositoryFactory impl
      */
     public static final String PARAM_JCR_REMOTING_SPILOG = "jcr.remoting.spilog";
 
+    /**
+     * Name of the system property that controls the referer header.
+     */
+    public static final String PARAM_JCR_REMOTING_REFERER = "jcr.remoting.referer";
+
     private static final Set<String> SCHEMES = new HashSet<String>();
     static {
         SCHEMES.add("http");
@@ -111,7 +116,9 @@ public class DAVExRepositoryFactory impl
 
             // set default params for httpclient that will be used in jackrabbit's webdav
client
             // this is to provide a referer header for all POST and PUT requests.
-            DefaultHttpParams.setHttpParamsFactory(new MyHttpParamsFactory());
+            DefaultHttpParams.setHttpParamsFactory(new MyHttpParamsFactory(
+                    System.getProperty(PARAM_JCR_REMOTING_REFERER, "http://localhost/")
+            ));
 
             System.out.printf("Connecting via JCR remoting to %s%n", address.getSpecificURI().toString());
             return new RepositoryFactoryImpl().getRepository(parameters);
@@ -148,10 +155,12 @@ class MyHttpParamsFactory implements Htt
 
     private final HttpParams params;
 
-    MyHttpParamsFactory() {
+    MyHttpParamsFactory(String referer) {
         params = new DefaultHttpParamsFactory().getDefaultParams();
         List<Header> headers = new ArrayList<Header>();
-        headers.add(new Header("Referer", "about:blank"));
+        if (referer != null && referer.length() > 0) {
+            headers.add(new Header("Referer", referer));
+        }
         params.setParameter(HostParams.DEFAULT_HEADERS, headers);
     }
 



Mime
View raw message