From 1d0a2728a20ec6be4f7d71b42c16669072e08497 Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edewata@redhat.com>
Date: Fri, 7 Feb 2014 13:44:34 -0500
Subject: [PATCH] Replaced deprecated ClientResponse class.

The ClientResponse class has been deprecated in RESTEasy 3.0, so most
of the code using the class has been modified to use the Response class
instead. There are a few remaining references to ClientResponse. They
will be removed separately later.
---
 .../src/com/netscape/certsrv/client/PKIClient.java |  6 ++---
 .../com/netscape/certsrv/client/PKIConnection.java |  5 +++--
 .../com/netscape/certsrv/group/GroupClient.java    | 17 ++++++--------
 .../src/com/netscape/certsrv/kra/KRAClient.java    | 26 ++++++++--------------
 .../com/netscape/certsrv/logging/AuditClient.java  |  7 +++---
 .../netscape/certsrv/profile/ProfileClient.java    | 14 +++++-------
 .../certsrv/system/TPSConnectorClient.java         | 14 +++++-------
 .../tps/authenticator/AuthenticatorClient.java     | 17 ++++++--------
 .../netscape/certsrv/tps/config/ConfigClient.java  |  7 +++---
 .../certsrv/tps/connection/ConnectionClient.java   | 17 ++++++--------
 .../certsrv/tps/profile/ProfileClient.java         | 17 ++++++--------
 .../certsrv/tps/profile/ProfileMappingClient.java  | 17 ++++++--------
 .../netscape/certsrv/tps/token/TokenClient.java    | 12 +++++-----
 .../src/com/netscape/certsrv/user/UserClient.java  | 22 ++++++++----------
 14 files changed, 80 insertions(+), 118 deletions(-)

diff --git a/base/common/src/com/netscape/certsrv/client/PKIClient.java b/base/common/src/com/netscape/certsrv/client/PKIClient.java
index 65a1b93ea1a025b4b3700d63b1751edcb33d2a7d..2b455fa8c893cd1941f0e29256825cafc1575007 100644
--- a/base/common/src/com/netscape/certsrv/client/PKIClient.java
+++ b/base/common/src/com/netscape/certsrv/client/PKIClient.java
@@ -6,11 +6,11 @@ import java.net.URISyntaxException;
 import java.net.URL;
 import java.security.cert.CertificateEncodingException;
 
+import javax.ws.rs.core.Response;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
-import org.jboss.resteasy.client.ClientResponse;
 import org.mozilla.jss.CryptoManager;
 import org.mozilla.jss.CryptoManager.NicknameConflictException;
 import org.mozilla.jss.CryptoManager.NotInitializedException;
@@ -72,8 +72,8 @@ public class PKIClient {
         return config.getSubsystem();
     }
 
-    public <T> T getEntity(ClientResponse<T> response) {
-        return connection.getEntity(response);
+    public <T> T getEntity(Response response, Class<T> clazz) {
+        return connection.getEntity(response, clazz);
     }
 
     public ClientConfig getConfig() {
diff --git a/base/common/src/com/netscape/certsrv/client/PKIConnection.java b/base/common/src/com/netscape/certsrv/client/PKIConnection.java
index cf103a9f8f043dc0e4a5330ce2902c3da55f469a..6e281dd5aace801ddd42c2d14586198b01f1e628 100644
--- a/base/common/src/com/netscape/certsrv/client/PKIConnection.java
+++ b/base/common/src/com/netscape/certsrv/client/PKIConnection.java
@@ -22,6 +22,7 @@ import java.util.HashSet;
 import java.util.List;
 
 import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
 
 import org.apache.commons.httpclient.ConnectTimeoutException;
 import org.apache.http.Header;
@@ -514,7 +515,7 @@ public class PKIConnection {
     }
 
     @SuppressWarnings("unchecked")
-    public <T> T getEntity(ClientResponse<T> response) {
+    public <T> T getEntity(Response response, Class<T> clazz) {
         BaseClientResponse<T> clientResponse = (BaseClientResponse<T>)response;
         try {
             clientResponse.checkFailureStatus();
@@ -526,7 +527,7 @@ public class PKIConnection {
             errorHandler.clientErrorHandling(clientResponse, e);
         }
 
-        return response.getEntity();
+        return clientResponse.getEntity();
     }
 
     public ClientResponse<String> post(String content) throws Exception {
diff --git a/base/common/src/com/netscape/certsrv/group/GroupClient.java b/base/common/src/com/netscape/certsrv/group/GroupClient.java
index 7470349f481f1f1a1f58cb499fe65b0b98a5dfa3..c5ff9796a643fcf85fc132b1adffac639440c780 100644
--- a/base/common/src/com/netscape/certsrv/group/GroupClient.java
+++ b/base/common/src/com/netscape/certsrv/group/GroupClient.java
@@ -19,7 +19,7 @@ package com.netscape.certsrv.group;
 
 import java.net.URISyntaxException;
 
-import org.jboss.resteasy.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import com.netscape.certsrv.client.Client;
 import com.netscape.certsrv.client.PKIClient;
@@ -49,15 +49,13 @@ public class GroupClient extends Client {
     }
 
     public GroupData addGroup(GroupData groupData) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<GroupData> response = (ClientResponse<GroupData>)groupClient.addGroup(groupData);
-        return client.getEntity(response);
+        Response response = groupClient.addGroup(groupData);
+        return client.getEntity(response, GroupData.class);
     }
 
     public GroupData modifyGroup(String groupID, GroupData groupData) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<GroupData> response = (ClientResponse<GroupData>)groupClient.modifyGroup(groupID, groupData);
-        return client.getEntity(response);
+        Response response = groupClient.modifyGroup(groupID, groupData);
+        return client.getEntity(response, GroupData.class);
     }
 
     public void removeGroup(String groupID) {
@@ -73,9 +71,8 @@ public class GroupClient extends Client {
     }
 
     public GroupMemberData addGroupMember(String groupID, String memberID) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<GroupMemberData> response = (ClientResponse<GroupMemberData>)groupClient.addGroupMember(groupID, memberID);
-        return client.getEntity(response);
+        Response response = groupClient.addGroupMember(groupID, memberID);
+        return client.getEntity(response, GroupMemberData.class);
     }
 
     public void removeGroupMember(String groupID, String memberID) {
diff --git a/base/common/src/com/netscape/certsrv/kra/KRAClient.java b/base/common/src/com/netscape/certsrv/kra/KRAClient.java
index 81d600c3395987772e865a79bb71d18183b21a5e..2666fb7365855665f1118952a0d5c6f6d886188c 100644
--- a/base/common/src/com/netscape/certsrv/kra/KRAClient.java
+++ b/base/common/src/com/netscape/certsrv/kra/KRAClient.java
@@ -4,7 +4,7 @@ import java.net.URISyntaxException;
 import java.util.Collection;
 import java.util.Iterator;
 
-import org.jboss.resteasy.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import com.netscape.certsrv.cert.CertData;
 import com.netscape.certsrv.client.PKIClient;
@@ -51,10 +51,8 @@ public class KRAClient extends SubsystemClient {
     }
 
     public String getTransportCert() {
-        @SuppressWarnings("unchecked")
-        ClientResponse<CertData> response = (ClientResponse<CertData>) systemCertClient
-                .getTransportCert();
-        CertData certData = client.getEntity(response);
+        Response response = systemCertClient.getTransportCert();
+        CertData certData = client.getEntity(response, CertData.class);
         String transportCert = certData.getEncoded();
         return transportCert;
     }
@@ -75,10 +73,8 @@ public class KRAClient extends SubsystemClient {
         data.setClientId(clientId);
         data.setDataType(dataType);
 
-        @SuppressWarnings("unchecked")
-        ClientResponse<KeyRequestInfo> response = (ClientResponse<KeyRequestInfo>)
-                keyRequestClient.archiveKey(data);
-        return client.getEntity(response);
+        Response response = keyRequestClient.archiveKey(data);
+        return client.getEntity(response, KeyRequestInfo.class);
     }
 
     public KeyDataInfo getKeyData(String clientId, String status) {
@@ -111,10 +107,8 @@ public class KRAClient extends SubsystemClient {
             data.setNonceData(Utils.base64encode(nonceData));
         }
 
-        @SuppressWarnings("unchecked")
-        ClientResponse<KeyRequestInfo> response = (ClientResponse<KeyRequestInfo>)
-                keyRequestClient.recoverKey(data);
-        return client.getEntity(response);
+        Response response = keyRequestClient.recoverKey(data);
+        return client.getEntity(response, KeyRequestInfo.class);
     }
 
     public void approveRecovery(RequestId recoveryId) {
@@ -151,10 +145,8 @@ public class KRAClient extends SubsystemClient {
         data.setKeyId(new KeyId(keyId));
         data.setCertificate(b64Certificate);
 
-        @SuppressWarnings("unchecked")
-        ClientResponse<KeyRequestInfo> response = (ClientResponse<KeyRequestInfo>)
-                keyRequestClient.recoverKey(data);
-        return client.getEntity(response).getRequestId();
+        Response response = keyRequestClient.recoverKey(data);
+        return client.getEntity(response, KeyRequestInfo.class).getRequestId();
     }
 
     public KeyData recoverKey(RequestId requestId, String passphrase) {
diff --git a/base/common/src/com/netscape/certsrv/logging/AuditClient.java b/base/common/src/com/netscape/certsrv/logging/AuditClient.java
index 5892a20cb860ddc0d03f001d1ffc1e6c03c9324f..959304d924c4126e07a747a28b3df9d584492bf7 100644
--- a/base/common/src/com/netscape/certsrv/logging/AuditClient.java
+++ b/base/common/src/com/netscape/certsrv/logging/AuditClient.java
@@ -19,7 +19,7 @@ package com.netscape.certsrv.logging;
 
 import java.net.URISyntaxException;
 
-import org.jboss.resteasy.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import com.netscape.certsrv.client.Client;
 import com.netscape.certsrv.client.PKIClient;
@@ -45,8 +45,7 @@ public class AuditClient extends Client {
     }
 
     public AuditConfig updateAuditConfig(AuditConfig auditConfig) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<AuditConfig> response = (ClientResponse<AuditConfig>)resource.updateAuditConfig(auditConfig);
-        return client.getEntity(response);
+        Response response = resource.updateAuditConfig(auditConfig);
+        return client.getEntity(response, AuditConfig.class);
     }
 }
diff --git a/base/common/src/com/netscape/certsrv/profile/ProfileClient.java b/base/common/src/com/netscape/certsrv/profile/ProfileClient.java
index 2ea6d86980adc317e2b974945a99d16d1b3ebd40..94ff487bb70f8255b7e1ed59cf289675f9ae1be5 100644
--- a/base/common/src/com/netscape/certsrv/profile/ProfileClient.java
+++ b/base/common/src/com/netscape/certsrv/profile/ProfileClient.java
@@ -19,7 +19,7 @@ package com.netscape.certsrv.profile;
 
 import java.net.URISyntaxException;
 
-import org.jboss.resteasy.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import com.netscape.certsrv.client.Client;
 import com.netscape.certsrv.client.PKIClient;
@@ -57,17 +57,13 @@ public class ProfileClient extends Client {
     }
 
     public ProfileData createProfile(ProfileData data) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<ProfileData> response =
-                (ClientResponse<ProfileData>) profileClient.createProfile(data);
-        return client.getEntity(response);
+        Response response = profileClient.createProfile(data);
+        return client.getEntity(response, ProfileData.class);
     }
 
     public ProfileData modifyProfile(ProfileData data) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<ProfileData> response =
-                (ClientResponse<ProfileData>) profileClient.modifyProfile(data.getId(), data);
-        return client.getEntity(response);
+        Response response = profileClient.modifyProfile(data.getId(), data);
+        return client.getEntity(response, ProfileData.class);
     }
 
     public void deleteProfile(String id) {
diff --git a/base/common/src/com/netscape/certsrv/system/TPSConnectorClient.java b/base/common/src/com/netscape/certsrv/system/TPSConnectorClient.java
index 0d5cff91b45d267aad7c724468d8e80a677a62b2..8662159ffbbeb51f9cd25c9c0b2d25a5756013ce 100644
--- a/base/common/src/com/netscape/certsrv/system/TPSConnectorClient.java
+++ b/base/common/src/com/netscape/certsrv/system/TPSConnectorClient.java
@@ -2,7 +2,7 @@ package com.netscape.certsrv.system;
 
 import java.net.URISyntaxException;
 
-import org.jboss.resteasy.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import com.netscape.certsrv.client.Client;
 import com.netscape.certsrv.client.PKIClient;
@@ -34,17 +34,13 @@ public class TPSConnectorClient extends Client {
     }
 
     public TPSConnectorData createConnector(String tpsHost, String tpsPort) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<TPSConnectorData> response = (ClientResponse<TPSConnectorData>)
-                tpsConnectorClient.createConnector(tpsHost, tpsPort);
-        return client.getEntity(response);
+        Response response = tpsConnectorClient.createConnector(tpsHost, tpsPort);
+        return client.getEntity(response, TPSConnectorData.class);
     }
 
     public TPSConnectorData modifyConnector(String id, TPSConnectorData data) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<TPSConnectorData> response = (ClientResponse<TPSConnectorData>)
-                tpsConnectorClient.modifyConnector(id, data);
-        return client.getEntity(response);
+        Response response = tpsConnectorClient.modifyConnector(id, data);
+        return client.getEntity(response, TPSConnectorData.class);
     }
 
     public void deleteConnector(String id) {
diff --git a/base/common/src/com/netscape/certsrv/tps/authenticator/AuthenticatorClient.java b/base/common/src/com/netscape/certsrv/tps/authenticator/AuthenticatorClient.java
index c4468e5cf5f04932d00270dc6e7e261e4ba89f6a..427cbf1107bcde3146284398d127bb33473a363e 100644
--- a/base/common/src/com/netscape/certsrv/tps/authenticator/AuthenticatorClient.java
+++ b/base/common/src/com/netscape/certsrv/tps/authenticator/AuthenticatorClient.java
@@ -19,7 +19,7 @@ package com.netscape.certsrv.tps.authenticator;
 
 import java.net.URISyntaxException;
 
-import org.jboss.resteasy.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import com.netscape.certsrv.client.Client;
 import com.netscape.certsrv.client.PKIClient;
@@ -49,21 +49,18 @@ public class AuthenticatorClient extends Client {
     }
 
     public AuthenticatorData addAuthenticator(AuthenticatorData authenticatorData) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<AuthenticatorData> response = (ClientResponse<AuthenticatorData>)resource.addAuthenticator(authenticatorData);
-        return client.getEntity(response);
+        Response response = resource.addAuthenticator(authenticatorData);
+        return client.getEntity(response, AuthenticatorData.class);
     }
 
     public AuthenticatorData updateAuthenticator(String authenticatorID, AuthenticatorData authenticatorData) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<AuthenticatorData> response = (ClientResponse<AuthenticatorData>)resource.updateAuthenticator(authenticatorID, authenticatorData);
-        return client.getEntity(response);
+        Response response = resource.updateAuthenticator(authenticatorID, authenticatorData);
+        return client.getEntity(response, AuthenticatorData.class);
     }
 
     public AuthenticatorData changeAuthenticatorStatus(String authenticatorID, String action) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<AuthenticatorData> response = (ClientResponse<AuthenticatorData>)resource.changeAuthenticatorStatus(authenticatorID, action);
-        return client.getEntity(response);
+        Response response = resource.changeAuthenticatorStatus(authenticatorID, action);
+        return client.getEntity(response, AuthenticatorData.class);
     }
 
     public void removeAuthenticator(String authenticatorID) {
diff --git a/base/common/src/com/netscape/certsrv/tps/config/ConfigClient.java b/base/common/src/com/netscape/certsrv/tps/config/ConfigClient.java
index 98699035a15ab0ce11c610354c12aa11a3bbf13d..a9821c6baf443a18f341f9f6b23cb74e9440fe3d 100644
--- a/base/common/src/com/netscape/certsrv/tps/config/ConfigClient.java
+++ b/base/common/src/com/netscape/certsrv/tps/config/ConfigClient.java
@@ -19,7 +19,7 @@ package com.netscape.certsrv.tps.config;
 
 import java.net.URISyntaxException;
 
-import org.jboss.resteasy.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import com.netscape.certsrv.client.Client;
 import com.netscape.certsrv.client.PKIClient;
@@ -45,8 +45,7 @@ public class ConfigClient extends Client {
     }
 
     public ConfigData updateConfig(ConfigData configData) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<ConfigData> response = (ClientResponse<ConfigData>)resource.updateConfig(configData);
-        return client.getEntity(response);
+        Response response = resource.updateConfig(configData);
+        return client.getEntity(response, ConfigData.class);
     }
 }
diff --git a/base/common/src/com/netscape/certsrv/tps/connection/ConnectionClient.java b/base/common/src/com/netscape/certsrv/tps/connection/ConnectionClient.java
index d7e1252d36754f0874e8c49c8aa363ccccd1b341..8014e56b1d763c1d8f349b5da1958d6594710bbf 100644
--- a/base/common/src/com/netscape/certsrv/tps/connection/ConnectionClient.java
+++ b/base/common/src/com/netscape/certsrv/tps/connection/ConnectionClient.java
@@ -19,7 +19,7 @@ package com.netscape.certsrv.tps.connection;
 
 import java.net.URISyntaxException;
 
-import org.jboss.resteasy.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import com.netscape.certsrv.client.Client;
 import com.netscape.certsrv.client.PKIClient;
@@ -49,21 +49,18 @@ public class ConnectionClient extends Client {
     }
 
     public ConnectionData addConnection(ConnectionData connectionData) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<ConnectionData> response = (ClientResponse<ConnectionData>)resource.addConnection(connectionData);
-        return client.getEntity(response);
+        Response response = resource.addConnection(connectionData);
+        return client.getEntity(response, ConnectionData.class);
     }
 
     public ConnectionData updateConnection(String connectionID, ConnectionData connectionData) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<ConnectionData> response = (ClientResponse<ConnectionData>)resource.updateConnection(connectionID, connectionData);
-        return client.getEntity(response);
+        Response response = resource.updateConnection(connectionID, connectionData);
+        return client.getEntity(response, ConnectionData.class);
     }
 
     public ConnectionData changeConnectionStatus(String connectionID, String action) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<ConnectionData> response = (ClientResponse<ConnectionData>)resource.changeConnectionStatus(connectionID, action);
-        return client.getEntity(response);
+        Response response = resource.changeConnectionStatus(connectionID, action);
+        return client.getEntity(response, ConnectionData.class);
     }
 
     public void removeConnection(String connectionID) {
diff --git a/base/common/src/com/netscape/certsrv/tps/profile/ProfileClient.java b/base/common/src/com/netscape/certsrv/tps/profile/ProfileClient.java
index 6f262e95a67c5884bfaa549cb0aecf63eb2a8f18..bf06f1566cbb56368fca90972ad7969d4d2f1305 100644
--- a/base/common/src/com/netscape/certsrv/tps/profile/ProfileClient.java
+++ b/base/common/src/com/netscape/certsrv/tps/profile/ProfileClient.java
@@ -19,7 +19,7 @@ package com.netscape.certsrv.tps.profile;
 
 import java.net.URISyntaxException;
 
-import org.jboss.resteasy.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import com.netscape.certsrv.client.Client;
 import com.netscape.certsrv.client.PKIClient;
@@ -53,21 +53,18 @@ public class ProfileClient extends Client {
     }
 
     public ProfileData addProfile(ProfileData profileData) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<ProfileData> response = (ClientResponse<ProfileData>)resource.addProfile(profileData);
-        return client.getEntity(response);
+        Response response = resource.addProfile(profileData);
+        return client.getEntity(response, ProfileData.class);
     }
 
     public ProfileData updateProfile(String profileID, ProfileData profileData) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<ProfileData> response = (ClientResponse<ProfileData>)resource.updateProfile(profileID, profileData);
-        return client.getEntity(response);
+        Response response = resource.updateProfile(profileID, profileData);
+        return client.getEntity(response, ProfileData.class);
     }
 
     public ProfileData changeProfileStatus(String profileID, String action) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<ProfileData> response = (ClientResponse<ProfileData>)resource.changeProfileStatus(profileID, action);
-        return client.getEntity(response);
+        Response response = resource.changeProfileStatus(profileID, action);
+        return client.getEntity(response, ProfileData.class);
     }
 
     public void removeProfile(String profileID) {
diff --git a/base/common/src/com/netscape/certsrv/tps/profile/ProfileMappingClient.java b/base/common/src/com/netscape/certsrv/tps/profile/ProfileMappingClient.java
index cd1d8227020050cf16753f7d6afa40162e67d29a..dcb35132edd7779a17168fa33bb8a763d54397c0 100644
--- a/base/common/src/com/netscape/certsrv/tps/profile/ProfileMappingClient.java
+++ b/base/common/src/com/netscape/certsrv/tps/profile/ProfileMappingClient.java
@@ -19,7 +19,7 @@ package com.netscape.certsrv.tps.profile;
 
 import java.net.URISyntaxException;
 
-import org.jboss.resteasy.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import com.netscape.certsrv.client.Client;
 import com.netscape.certsrv.client.PKIClient;
@@ -49,21 +49,18 @@ public class ProfileMappingClient extends Client {
     }
 
     public ProfileMappingData addProfileMapping(ProfileMappingData profileMappingData) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<ProfileMappingData> response = (ClientResponse<ProfileMappingData>)resource.addProfileMapping(profileMappingData);
-        return client.getEntity(response);
+        Response response = resource.addProfileMapping(profileMappingData);
+        return client.getEntity(response, ProfileMappingData.class);
     }
 
     public ProfileMappingData updateProfileMapping(String profileMappingID, ProfileMappingData profileMappingData) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<ProfileMappingData> response = (ClientResponse<ProfileMappingData>)resource.updateProfileMapping(profileMappingID, profileMappingData);
-        return client.getEntity(response);
+        Response response = resource.updateProfileMapping(profileMappingID, profileMappingData);
+        return client.getEntity(response, ProfileMappingData.class);
     }
 
     public ProfileMappingData changeProfileMappingStatus(String profileMappingID, String action) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<ProfileMappingData> response = (ClientResponse<ProfileMappingData>)resource.changeProfileMappingStatus(profileMappingID, action);
-        return client.getEntity(response);
+        Response response = resource.changeProfileMappingStatus(profileMappingID, action);
+        return client.getEntity(response, ProfileMappingData.class);
     }
 
     public void removeProfileMapping(String profileMappingID) {
diff --git a/base/common/src/com/netscape/certsrv/tps/token/TokenClient.java b/base/common/src/com/netscape/certsrv/tps/token/TokenClient.java
index e349acd1e5af660870919c3f24fde43359a9d412..35f6e16759729fd0f8edcbaaec9290d49247fe61 100644
--- a/base/common/src/com/netscape/certsrv/tps/token/TokenClient.java
+++ b/base/common/src/com/netscape/certsrv/tps/token/TokenClient.java
@@ -19,7 +19,7 @@ package com.netscape.certsrv.tps.token;
 
 import java.net.URISyntaxException;
 
-import org.jboss.resteasy.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import com.netscape.certsrv.client.Client;
 import com.netscape.certsrv.client.PKIClient;
@@ -49,15 +49,13 @@ public class TokenClient extends Client {
     }
 
     public TokenData addToken(TokenData tokenData) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<TokenData> response = (ClientResponse<TokenData>)resource.addToken(tokenData);
-        return client.getEntity(response);
+        Response response = resource.addToken(tokenData);
+        return client.getEntity(response, TokenData.class);
     }
 
     public TokenData updateToken(String tokenID, TokenData tokenData) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<TokenData> response = (ClientResponse<TokenData>)resource.replaceToken(tokenID, tokenData);
-        return client.getEntity(response);
+        Response response = resource.replaceToken(tokenID, tokenData);
+        return client.getEntity(response, TokenData.class);
     }
 
     public void removeToken(String tokenID) {
diff --git a/base/common/src/com/netscape/certsrv/user/UserClient.java b/base/common/src/com/netscape/certsrv/user/UserClient.java
index 59de6465229605f46abe876d1b49fe69fd6798ff..33ed61d2aa4780b2255678d00e1a018750dd3301 100644
--- a/base/common/src/com/netscape/certsrv/user/UserClient.java
+++ b/base/common/src/com/netscape/certsrv/user/UserClient.java
@@ -19,7 +19,7 @@ package com.netscape.certsrv.user;
 
 import java.net.URISyntaxException;
 
-import org.jboss.resteasy.client.ClientResponse;
+import javax.ws.rs.core.Response;
 
 import com.netscape.certsrv.client.Client;
 import com.netscape.certsrv.client.PKIClient;
@@ -49,15 +49,13 @@ public class UserClient extends Client {
     }
 
     public UserData addUser(UserData userData) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<UserData> response = (ClientResponse<UserData>)userClient.addUser(userData);
-        return client.getEntity(response);
+        Response response = userClient.addUser(userData);
+        return client.getEntity(response, UserData.class);
     }
 
     public UserData modifyUser(String userID, UserData userData) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<UserData> response = (ClientResponse<UserData>)userClient.modifyUser(userID, userData);
-        return client.getEntity(response);
+        Response response = userClient.modifyUser(userID, userData);
+        return client.getEntity(response, UserData.class);
     }
 
     public void removeUser(String userID) {
@@ -73,9 +71,8 @@ public class UserClient extends Client {
     }
 
     public UserCertData addUserCert(String userID, UserCertData userCertData) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<UserCertData> response = (ClientResponse<UserCertData>)userClient.addUserCert(userID, userCertData);
-        return client.getEntity(response);
+        Response response = userClient.addUserCert(userID, userCertData);
+        return client.getEntity(response, UserCertData.class);
     }
 
     public void removeUserCert(String userID, String certID) {
@@ -87,9 +84,8 @@ public class UserClient extends Client {
     }
 
     public UserMembershipData addUserMembership(String userID, String groupID) {
-        @SuppressWarnings("unchecked")
-        ClientResponse<UserMembershipData> response = (ClientResponse<UserMembershipData>)userClient.addUserMembership(userID, groupID);
-        return client.getEntity(response);
+        Response response = userClient.addUserMembership(userID, groupID);
+        return client.getEntity(response, UserMembershipData.class);
     }
 
     public void removeUserMembership(String userD, String groupID) {
-- 
1.8.4.2

