diff options
author | Endi S. Dewata <edewata@redhat.com> | 2015-10-20 21:07:33 +0200 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2015-10-22 17:42:28 +0200 |
commit | aaacd71a2f125501645885d3da1de18459782572 (patch) | |
tree | 406ccb7219a99335482e343de37ed985d6973120 /base/common/src | |
parent | 60fa66aa04ec61350420d95a554c0cec7834ebbd (diff) | |
download | pki-aaacd71a2f125501645885d3da1de18459782572.tar.gz pki-aaacd71a2f125501645885d3da1de18459782572.tar.xz pki-aaacd71a2f125501645885d3da1de18459782572.zip |
Replaced legacy HttpClient.
The ConfigurationUtils and CertUtil have been modified to use
PKIConnection which uses Apache HttpClient instead of the legacy
custom HttpClient. The POST request content is now created using
MultivaluedMap.
The PKIConnection has been modified to provide a get() method to
send an HTTP GET request. The post() method was modified to accept
a path parameter.
https://fedorahosted.org/pki/ticket/342
Diffstat (limited to 'base/common/src')
-rw-r--r-- | base/common/src/com/netscape/certsrv/client/PKIConnection.java | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/base/common/src/com/netscape/certsrv/client/PKIConnection.java b/base/common/src/com/netscape/certsrv/client/PKIConnection.java index fb7694615..88a2089bb 100644 --- a/base/common/src/com/netscape/certsrv/client/PKIConnection.java +++ b/base/common/src/com/netscape/certsrv/client/PKIConnection.java @@ -217,6 +217,7 @@ public class PKIConnection { this.verbose = verbose; } + public void setCallback(SSLCertificateApprovalCallback callback) { this.callback = callback; } @@ -457,9 +458,22 @@ public class PKIConnection { } } - public String post(MultivaluedMap<String, String> form) throws Exception { - ResteasyWebTarget target = resteasyClient.target(config.getServerURI()); - return target.request().post(Entity.form(form), String.class); + public String get(String path) throws Exception { + String uri = config.getServerURI().toString(); + if (path != null) { + uri += path; + } + ResteasyWebTarget target = resteasyClient.target(uri); + return target.request().get(String.class); + } + + public String post(String path, MultivaluedMap<String, String> content) throws Exception { + String uri = config.getServerURI().toString(); + if (path != null) { + uri += path; + } + ResteasyWebTarget target = resteasyClient.target(uri); + return target.request().post(Entity.form(content), String.class); } public File getOutput() { |