The PKIConnection has been modified to provide two get() methods:
one returning a generic Response object wnd the other returning an
object with the specified type. The ConfigurationUtils has been
modified accordingly.

https://fedorahosted.org/pki/ticket/1517

Pushed to master and 10.3 branch under trivial/one-liner rule.

--
Endi S. Dewata
>From 0d07dfb75f06c0bd40bb799b6e3ac20069c031da Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edew...@redhat.com>
Date: Wed, 23 Nov 2016 04:30:00 +0100
Subject: [PATCH] Refactored PKIConnection.get().

The PKIConnection has been modified to provide two get() methods:
one returning a generic Response object wnd the other returning an
object with the specified type. The ConfigurationUtils has been
modified accordingly.

https://fedorahosted.org/pki/ticket/1517
---
 base/common/src/com/netscape/certsrv/client/PKIConnection.java    | 8 ++++++--
 .../src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java  | 2 +-
 2 files changed, 7 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 88a2089bba2155e41d8c99a2496d3d288d4dc328..301c4c69b5e14181dae3471156d046b643727d54 100644
--- a/base/common/src/com/netscape/certsrv/client/PKIConnection.java
+++ b/base/common/src/com/netscape/certsrv/client/PKIConnection.java
@@ -458,13 +458,17 @@ public class PKIConnection {
         }
     }
 
-    public String get(String path) throws Exception {
+    public Response get(String path) throws Exception {
+        return get(path, Response.class);
+    }
+
+    public <T> T get(String path, Class<T> responseType) throws Exception {
         String uri = config.getServerURI().toString();
         if (path != null) {
             uri += path;
         }
         ResteasyWebTarget target = resteasyClient.target(uri);
-        return target.request().get(String.class);
+        return target.request().get(responseType);
     }
 
     public String post(String path, MultivaluedMap<String, String> content) throws Exception {
diff --git a/base/server/cms/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java b/base/server/cms/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java
index 9a39de051b118217e7d9f9ede9b63e8fb457c440..dcccf4a6b6a968decf4f869b8bbbe75d0d8c823e 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java
@@ -234,7 +234,7 @@ public class ConfigurationUtils {
         PKIConnection connection = new PKIConnection(config);
         if (certApprovalCallback == null) certApprovalCallback = ConfigurationUtils.certApprovalCallback;
         connection.setCallback(certApprovalCallback);
-        return connection.get(path);
+        return connection.get(path, String.class);
     }
 
     public static String post(String hostname, int port, boolean secure,
-- 
2.5.5

_______________________________________________
Pki-devel mailing list
Pki-devel@redhat.com
https://www.redhat.com/mailman/listinfo/pki-devel

Reply via email to