summaryrefslogtreecommitdiffstats
path: root/base/common/src/com/netscape/certsrv/client/PKIClient.java
diff options
context:
space:
mode:
authorAde Lee <alee@redhat.com>2012-09-24 23:23:06 -0400
committerAde Lee <alee@redhat.com>2012-09-27 22:40:00 -0400
commit854ecce0fc312e65804d84041cbc93b17cce88a5 (patch)
tree877c2bf51cebaf99fba5645705d46fcef6c6bb2d /base/common/src/com/netscape/certsrv/client/PKIClient.java
parent1726794341e9e58256004f040b276fa579161b6b (diff)
downloadpki-854ecce0fc312e65804d84041cbc93b17cce88a5.tar.gz
pki-854ecce0fc312e65804d84041cbc93b17cce88a5.tar.xz
pki-854ecce0fc312e65804d84041cbc93b17cce88a5.zip
fall back to old interface for installtoken if needed
Diffstat (limited to 'base/common/src/com/netscape/certsrv/client/PKIClient.java')
-rw-r--r--base/common/src/com/netscape/certsrv/client/PKIClient.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/base/common/src/com/netscape/certsrv/client/PKIClient.java b/base/common/src/com/netscape/certsrv/client/PKIClient.java
index 5127c052d..e725faa13 100644
--- a/base/common/src/com/netscape/certsrv/client/PKIClient.java
+++ b/base/common/src/com/netscape/certsrv/client/PKIClient.java
@@ -12,6 +12,8 @@ import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
+import javax.ws.rs.core.MediaType;
+
import org.apache.commons.httpclient.ConnectTimeoutException;
import org.apache.http.Header;
import org.apache.http.HttpEntityEnclosingRequest;
@@ -38,6 +40,7 @@ import org.apache.http.impl.client.RequestWrapper;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.HttpContext;
import org.jboss.resteasy.client.ClientExecutor;
+import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.client.ClientResponseFailure;
import org.jboss.resteasy.client.ProxyFactory;
@@ -51,7 +54,7 @@ import org.mozilla.jss.ssl.SSLCertificateApprovalCallback;
import org.mozilla.jss.ssl.SSLSocket;
-public abstract class PKIClient {
+public class PKIClient {
protected boolean verbose;
@@ -294,6 +297,18 @@ public abstract class PKIClient {
return response.getEntity();
}
+ public ClientResponse<String> post(String content) {
+ ClientResponse<String> response = null;
+ ClientRequest request = executor.createRequest(config.getServerURI().toString());
+ request.body(MediaType.APPLICATION_FORM_URLENCODED, content);
+ try {
+ response = request.post(String.class);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return response;
+ }
+
public boolean isVerbose() {
return verbose;
}