diff --git a/build.gradle b/build.gradle
index 5781d2e..a7085e3 100644
--- a/build.gradle
+++ b/build.gradle
@@ -11,9 +11,9 @@ dependencies {
compile "commons-codec:commons-codec:1.9"
compile "commons-lang:commons-lang:2.6"
compile "commons-logging:commons-logging:1.2"
- compile "org.apache.httpcomponents:httpcore:4.3.2"
- compile "org.apache.httpcomponents:httpmime:4.3.5"
- compile "org.apache.httpcomponents:httpclient:4.3.5"
+ compile "org.apache.httpcomponents:httpcore:4.4.4"
+ compile "org.apache.httpcomponents:httpmime:4.5.2"
+ compile "org.apache.httpcomponents:httpclient:4.5.2"
compile 'com.fasterxml.jackson.core:jackson-databind:2.2.3'
compile 'com.fasterxml.jackson.core:jackson-core:2.2.3'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.2.3'
@@ -22,7 +22,7 @@ dependencies {
jar {
baseName = 'jDeployR'
- version = '8.0.0'
+ version = '8.0.5'
}
javadoc {
diff --git a/examples/tutorial/build.gradle b/examples/tutorial/build.gradle
index fd9932e..404d454 100644
--- a/examples/tutorial/build.gradle
+++ b/examples/tutorial/build.gradle
@@ -4,7 +4,7 @@ apply plugin: 'application'
sourceCompatibility = "1.6"
targetCompatibility = "1.6"
-applicationDefaultJvmArgs = ["-Dendpoint=http://localhost:8000/deployr",
+applicationDefaultJvmArgs = ["-Dendpoint=http://localhost:8050/deployr",
"-Dusername=testuser",
"-Dpassword=ADD_TESTUSER_PASSWORD"]
@@ -17,9 +17,9 @@ dependencies {
compile "commons-codec:commons-codec:1.9"
compile "commons-lang:commons-lang:2.6"
compile "commons-logging:commons-logging:1.2"
- compile "org.apache.httpcomponents:httpcore:4.3.2"
- compile "org.apache.httpcomponents:httpmime:4.3.5"
- compile "org.apache.httpcomponents:httpclient:4.3.5"
+ compile "org.apache.httpcomponents:httpcore:4.4.4"
+ compile "org.apache.httpcomponents:httpmime:4.5.2"
+ compile "org.apache.httpcomponents:httpclient:4.5.2"
compile 'com.fasterxml.jackson.core:jackson-databind:2.2.3'
compile 'com.fasterxml.jackson.core:jackson-core:2.2.3'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.2.3'
@@ -28,7 +28,7 @@ dependencies {
jar {
baseName = 'client-tutorial'
- version = '8.0.0'
+ version = '8.0.5'
}
task execute(type: JavaExec) {
diff --git a/src/main/java/com/revo/deployr/client/RClient.java b/src/main/java/com/revo/deployr/client/RClient.java
index 6b60541..e8a4006 100644
--- a/src/main/java/com/revo/deployr/client/RClient.java
+++ b/src/main/java/com/revo/deployr/client/RClient.java
@@ -197,27 +197,6 @@ public URL renderScript(String scriptName,
throws RClientException,
RDataException;
- /**
- * Execute a repository-managed shell script. Execution occurs on the
- * DeployR server. The response captures the line-by-line console output
- * generated by the execution of the shell script on the server.
- * Only shell scripts created by an ADMIN user on the DeployR server
- * can be executed on this call. All attempts to execute shell scripts
- * not created by an ADMIN user will be rejected. Access to shell
- * scripts is also governed by standard repository access controls.
- *
- * @throws RClientException if RClient fails to complete call.
- * @throws RSecurityException if DeployR server security conditions not met on call.
- */
- public List executeShell(String shellName,
- String shellDirectory,
- String shellAuthor,
- String shellVersion,
- String args)
- throws RClientException,
- RSecurityException,
- RDataException;
-
/**
* Interrupts the current execution on the HTTP blackbox project associated
* with the current HTTP session.
diff --git a/src/main/java/com/revo/deployr/client/about/RRepositoryFileDetails.java b/src/main/java/com/revo/deployr/client/about/RRepositoryFileDetails.java
index be1a58e..e4749a6 100644
--- a/src/main/java/com/revo/deployr/client/about/RRepositoryFileDetails.java
+++ b/src/main/java/com/revo/deployr/client/about/RRepositoryFileDetails.java
@@ -30,7 +30,7 @@ public RRepositoryFileDetails(String filename, String directory,
String restricted, boolean shared, boolean published,
List authors, String inputs, String outputs,
String tags, RRepositoryFile.Category category,
- String md5, Date lastModified) {
+ String sha256, Date lastModified) {
this.filename = filename;
this.directory = directory;
this.author = author;
@@ -48,7 +48,8 @@ public RRepositoryFileDetails(String filename, String directory,
this.outputs = outputs;
this.tags = tags;
this.category = category;
- this.md5 = md5;
+ this.sha256 = sha256;
+ this.md5 = this.sha256; // @deprecated - as of 8.0.5 server, use sha256
this.lastModified = lastModified;
this.url = url;
}
@@ -142,8 +143,14 @@ public RRepositoryFileDetails(String filename, String directory,
*/
public final RRepositoryFile.Category category;
+ /**
+ * Repository file 256 checksum.
+ */
+ public final String sha256;
+
/**
* Repository file md5 checksum.
+ * @deprecated As of release 8.0.5 server, replaced by {@link #sha256}
*/
public final String md5;
@@ -156,6 +163,4 @@ public RRepositoryFileDetails(String filename, String directory,
* Repository file url.
*/
public final URL url;
-
-
}
diff --git a/src/main/java/com/revo/deployr/client/about/RUserDetails.java b/src/main/java/com/revo/deployr/client/about/RUserDetails.java
index 6b37625..4bb0a38 100644
--- a/src/main/java/com/revo/deployr/client/about/RUserDetails.java
+++ b/src/main/java/com/revo/deployr/client/about/RUserDetails.java
@@ -18,11 +18,16 @@
public class RUserDetails {
- public RUserDetails(String username, String displayname, String cookie, RUserLimitDetails limits) {
+ public RUserDetails(String username,
+ String displayname,
+ String cookie,
+ String csrf,
+ RUserLimitDetails limits) {
this.username = username;
this.displayname = displayname;
this.cookie = cookie;
+ this.csrf = csrf;
this.limits = limits;
}
@@ -45,4 +50,9 @@ public RUserDetails(String username, String displayname, String cookie, RUserLim
* About limits for currently authenticated user.
*/
public final RUserLimitDetails limits;
+
+ /**
+ * The `X_CSRF_TOKEN` value.
+ */
+ public final String csrf;
}
diff --git a/src/main/java/com/revo/deployr/client/call/AbstractCall.java b/src/main/java/com/revo/deployr/client/call/AbstractCall.java
index 35d9ee2..23b3e8b 100644
--- a/src/main/java/com/revo/deployr/client/call/AbstractCall.java
+++ b/src/main/java/com/revo/deployr/client/call/AbstractCall.java
@@ -51,10 +51,9 @@ public abstract class AbstractCall implements RCall, RCoreResponse {
protected HttpClient httpClient;
protected String serverUrl;
protected Future future;
- protected HttpUriRequest httpUriRequest;
-
-
+ protected HttpUriRequest httpUriRequest;
protected Map httpParams = new HashMap();
+ protected Map httpHeaders = new HashMap();
/**
* Method, internal use only.
@@ -118,6 +117,12 @@ public boolean isCompleted() {
return future.isDone();
}
+ public void addHeader(String name, String value) {
+ if (value != null) {
+ httpHeaders.put(name, value);
+ }
+ }
+
/*
* Protected implementation making HTTP Request.
*/
@@ -164,17 +169,18 @@ protected RCoreResult makeRequest(HttpUriRequest httpUriRequest, String API) {
RCoreResultImpl pResult = null;
try {
+ // set any custom headers on the request
+ for (Map.Entry entry : httpHeaders.entrySet()) {
+ httpUriRequest.addHeader(entry.getKey(), entry.getValue());
+ }
HttpResponse response = httpClient.execute(this.httpUriRequest);
StatusLine statusLine = response.getStatusLine();
HttpEntity responseEntity = response.getEntity();
String markup = EntityUtils.toString(responseEntity);
-
- pResult = new RCoreResultImpl();
-
- pResult.parseMarkup(markup, API, statusLine.getStatusCode(), statusLine.getReasonPhrase());
-
+ pResult = new RCoreResultImpl(response.getAllHeaders());
+ pResult.parseMarkup(markup, API, statusLine.getStatusCode(), statusLine.getReasonPhrase());
} catch (UnsupportedEncodingException ueex) {
log.warn("AbstractCall: makeRequest unsupported encoding exception=" + ueex);
} catch (IOException ioex) {
diff --git a/src/main/java/com/revo/deployr/client/call/project/ProjectDirectoryUploadCall.java b/src/main/java/com/revo/deployr/client/call/project/ProjectDirectoryUploadCall.java
index edd6907..7524b30 100644
--- a/src/main/java/com/revo/deployr/client/call/project/ProjectDirectoryUploadCall.java
+++ b/src/main/java/com/revo/deployr/client/call/project/ProjectDirectoryUploadCall.java
@@ -37,6 +37,7 @@
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import java.util.concurrent.Callable;
/**
@@ -72,7 +73,7 @@ public RCoreResult call() {
try {
HttpPost httpPost = new HttpPost(serverUrl + API);
- super.httpUriRequest = httpPost;
+ super.httpUriRequest = httpPost;
List postParams = new ArrayList();
postParams.add(new BasicNameValuePair("format", "json"));
@@ -91,12 +92,17 @@ public RCoreResult call() {
httpPost.setEntity(entity);
+ // set any custom headers on the request
+ for (Map.Entry entry : httpHeaders.entrySet()) {
+ httpPost.addHeader(entry.getKey(), entry.getValue());
+ }
+
HttpResponse response = httpClient.execute(httpPost);
StatusLine statusLine = response.getStatusLine();
HttpEntity responseEntity = response.getEntity();
String markup = EntityUtils.toString(responseEntity);
-
- pResult = new RCoreResultImpl();
+
+ pResult = new RCoreResultImpl(response.getAllHeaders());
pResult.parseMarkup(markup, API, statusLine.getStatusCode(), statusLine.getReasonPhrase());
} catch (UnsupportedEncodingException ueex) {
diff --git a/src/main/java/com/revo/deployr/client/call/project/ProjectImportCall.java b/src/main/java/com/revo/deployr/client/call/project/ProjectImportCall.java
index 114e252..922b359 100644
--- a/src/main/java/com/revo/deployr/client/call/project/ProjectImportCall.java
+++ b/src/main/java/com/revo/deployr/client/call/project/ProjectImportCall.java
@@ -36,6 +36,7 @@
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import java.util.concurrent.Callable;
/**
@@ -83,12 +84,17 @@ public RCoreResult call() {
httpPost.setEntity(entity);
+ // set any custom headers on the request
+ for (Map.Entry entry : httpHeaders.entrySet()) {
+ httpPost.addHeader(entry.getKey(), entry.getValue());
+ }
+
HttpResponse response = httpClient.execute(httpPost);
StatusLine statusLine = response.getStatusLine();
HttpEntity responseEntity = response.getEntity();
String markup = EntityUtils.toString(responseEntity);
-
- pResult = new RCoreResultImpl();
+
+ pResult = new RCoreResultImpl(response.getAllHeaders());
pResult.parseMarkup(markup, API, statusLine.getStatusCode(), statusLine.getReasonPhrase());
} catch (UnsupportedEncodingException ueex) {
diff --git a/src/main/java/com/revo/deployr/client/call/project/ProjectWorkspaceUploadCall.java b/src/main/java/com/revo/deployr/client/call/project/ProjectWorkspaceUploadCall.java
index 4122b17..bcea108 100644
--- a/src/main/java/com/revo/deployr/client/call/project/ProjectWorkspaceUploadCall.java
+++ b/src/main/java/com/revo/deployr/client/call/project/ProjectWorkspaceUploadCall.java
@@ -36,6 +36,7 @@
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import java.util.concurrent.Callable;
/**
@@ -86,12 +87,17 @@ public RCoreResult call() {
httpPost.setEntity(entity);
+ // set any custom headers on the request
+ for (Map.Entry entry : httpHeaders.entrySet()) {
+ httpPost.addHeader(entry.getKey(), entry.getValue());
+ }
+
HttpResponse response = httpClient.execute(httpPost);
StatusLine statusLine = response.getStatusLine();
HttpEntity responseEntity = response.getEntity();
String markup = EntityUtils.toString(responseEntity);
- pResult = new RCoreResultImpl();
+ pResult = new RCoreResultImpl(response.getAllHeaders());
pResult.parseMarkup(markup, API, statusLine.getStatusCode(), statusLine.getReasonPhrase());
} catch (UnsupportedEncodingException ueex) {
diff --git a/src/main/java/com/revo/deployr/client/call/repository/RepositoryDirectoryUploadCall.java b/src/main/java/com/revo/deployr/client/call/repository/RepositoryDirectoryUploadCall.java
index 176f979..f1cde13 100644
--- a/src/main/java/com/revo/deployr/client/call/repository/RepositoryDirectoryUploadCall.java
+++ b/src/main/java/com/revo/deployr/client/call/repository/RepositoryDirectoryUploadCall.java
@@ -37,6 +37,7 @@
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import java.util.concurrent.Callable;
/**
@@ -96,12 +97,17 @@ public RCoreResult call() {
httpPost.setEntity(entity);
+ // set any custom headers on the request
+ for (Map.Entry entry : httpHeaders.entrySet()) {
+ httpPost.addHeader(entry.getKey(), entry.getValue());
+ }
+
HttpResponse response = httpClient.execute(httpPost);
StatusLine statusLine = response.getStatusLine();
HttpEntity responseEntity = response.getEntity();
String markup = EntityUtils.toString(responseEntity);
- pResult = new RCoreResultImpl();
+ pResult = new RCoreResultImpl(response.getAllHeaders());
pResult.parseMarkup(markup, API, statusLine.getStatusCode(), statusLine.getReasonPhrase());
} catch (UnsupportedEncodingException ueex) {
diff --git a/src/main/java/com/revo/deployr/client/call/repository/RepositoryFileUploadCall.java b/src/main/java/com/revo/deployr/client/call/repository/RepositoryFileUploadCall.java
index 2af0610..7ec2214 100644
--- a/src/main/java/com/revo/deployr/client/call/repository/RepositoryFileUploadCall.java
+++ b/src/main/java/com/revo/deployr/client/call/repository/RepositoryFileUploadCall.java
@@ -37,6 +37,7 @@
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import java.util.concurrent.Callable;
/**
@@ -100,12 +101,17 @@ public RCoreResult call() {
httpPost.setEntity(entity);
+ // set any custom headers on the request
+ for (Map.Entry entry : httpHeaders.entrySet()) {
+ httpPost.addHeader(entry.getKey(), entry.getValue());
+ }
+
HttpResponse response = httpClient.execute(httpPost);
StatusLine statusLine = response.getStatusLine();
HttpEntity responseEntity = response.getEntity();
String markup = EntityUtils.toString(responseEntity);
-
- pResult = new RCoreResultImpl();
+
+ pResult = new RCoreResultImpl(response.getAllHeaders());
pResult.parseMarkup(markup, API, statusLine.getStatusCode(), statusLine.getReasonPhrase());
} catch (UnsupportedEncodingException ueex) {
diff --git a/src/main/java/com/revo/deployr/client/call/repository/RepositoryShellExecuteCall.java b/src/main/java/com/revo/deployr/client/call/repository/RepositoryShellExecuteCall.java
deleted file mode 100644
index 25ef4f0..0000000
--- a/src/main/java/com/revo/deployr/client/call/repository/RepositoryShellExecuteCall.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * RepositoryShellExecuteCall.java
- *
- * Copyright (C) 2010-2016, Microsoft Corporation
- *
- * This program is licensed to you under the terms of Version 2.0 of the
- * Apache License. This program is distributed WITHOUT
- * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
- * Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) for more details.
- *
- */
-package com.revo.deployr.client.call.repository;
-
-import com.revo.deployr.client.core.RCoreResult;
-import com.revo.deployr.client.call.AbstractCall;
-import com.revo.deployr.client.core.REndpoints;
-
-import java.util.concurrent.Callable;
-
-/**
- * Provides support for DeployR API call: /r/repository/shell/execute.
- *
- * Simply construct an instance of this call and pass it on the
- * executeShell() method of your {@link com.revo.deployr.client.RClient}.
- */
-public class RepositoryShellExecuteCall extends AbstractCall
- implements Callable {
-
- private final String API = REndpoints.RREPOSITORYSHELLEXECUTE;
-
- public RepositoryShellExecuteCall(String shellName,
- String shellDirectory,
- String shellAuthor,
- String shellVersion,
- String shellArgs) {
-
- httpParams.put("filename", shellName);
- httpParams.put("directory", shellDirectory);
- httpParams.put("author", shellAuthor);
- httpParams.put("version", shellVersion);
- httpParams.put("args", shellArgs);
- httpParams.put("format", "json");
- }
-
- /**
- * Internal use only, to execute call use RClient.executeShell().
- */
- public RCoreResult call() {
-
- return makePostRequest(API);
- }
-
-}
diff --git a/src/main/java/com/revo/deployr/client/core/RCoreResult.java b/src/main/java/com/revo/deployr/client/core/RCoreResult.java
index 365a153..720fbb6 100644
--- a/src/main/java/com/revo/deployr/client/core/RCoreResult.java
+++ b/src/main/java/com/revo/deployr/client/core/RCoreResult.java
@@ -17,11 +17,24 @@
import java.util.List;
import java.util.Map;
+import org.apache.http.Header;
+
/**
* Represents the result of a completed DeployR API call.
*/
public interface RCoreResult {
+ /**
+ * Returns the HTTP Response Headers from the DeployR API call that
+ * generated this result.
+ *
+ *
+ * Available: always.
+ *
+ * @returns response headers.
+ */
+ public Header[] getHeaders();
+
/**
* Returns the call result status of the DeployR API call.
*
@@ -43,14 +56,14 @@ public interface RCoreResult {
public String getCall();
/**
- * Returns the HTTP session cookie associated with the DeployR API call.
+ * Returns a unique id for the request.
*
*
- * Available: on LoginCall.
+ * Available: always.
*
* @returns String
*/
- public String getCookie();
+ public String getUid();
/**
* Returns identity information on currently logged-in user making the DeployR API call.
@@ -132,15 +145,6 @@ public interface RCoreResult {
*/
public List