diff options
Diffstat (limited to 'base')
3 files changed, 33 insertions, 18 deletions
diff --git a/base/common/src/com/netscape/certsrv/key/KeyClient.java b/base/common/src/com/netscape/certsrv/key/KeyClient.java index bdb84fddb..374b793ff 100644 --- a/base/common/src/com/netscape/certsrv/key/KeyClient.java +++ b/base/common/src/com/netscape/certsrv/key/KeyClient.java @@ -102,7 +102,7 @@ public class KeyClient extends Client { Integer pageSize, Integer maxResults, Integer maxTime) { - return keyRequestClient.listRequests( + Response response = keyRequestClient.listRequests( requestState, requestType, clientID, @@ -110,10 +110,12 @@ public class KeyClient extends Client { pageSize, maxResults, maxTime); + return client.getEntity(response, KeyRequestInfoCollection.class); } public KeyRequestInfo getRequestInfo(RequestId id) { - return keyRequestClient.getRequestInfo(id); + Response response = keyRequestClient.getRequestInfo(id); + return client.getEntity(response, KeyRequestInfo.class); } public KeyRequestResponse archiveSecurityData(byte[] encoded, String clientId, String dataType, String algorithm, int strength) { @@ -172,14 +174,17 @@ public class KeyClient extends Client { } public void approveRequest(RequestId id) { - keyRequestClient.approveRequest(id); + Response response = keyRequestClient.approveRequest(id); + client.getEntity(response, Void.class); } public void rejectRequest(RequestId id) { - keyRequestClient.rejectRequest(id); + Response response = keyRequestClient.rejectRequest(id); + client.getEntity(response, Void.class); } public void cancelRequest(RequestId id) { - keyRequestClient.cancelRequest(id); + Response response = keyRequestClient.cancelRequest(id); + client.getEntity(response, Void.class); } } diff --git a/base/common/src/com/netscape/certsrv/key/KeyRequestResource.java b/base/common/src/com/netscape/certsrv/key/KeyRequestResource.java index e6e6c2e70..867136bc1 100644 --- a/base/common/src/com/netscape/certsrv/key/KeyRequestResource.java +++ b/base/common/src/com/netscape/certsrv/key/KeyRequestResource.java @@ -40,8 +40,9 @@ public interface KeyRequestResource { * Used to generate list of key requests based on the search parameters */ @GET + @ClientResponseType(entityType=KeyRequestInfoCollection.class) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public KeyRequestInfoCollection listRequests(@QueryParam("requestState") String requestState, + public Response listRequests(@QueryParam("requestState") String requestState, @QueryParam("requestType") String requestType, @QueryParam("clientID") String clientID, @QueryParam("start") RequestId start, @@ -66,19 +67,22 @@ public interface KeyRequestResource { */ @GET @Path("{id}") + @ClientResponseType(entityType=KeyRequestInfo.class) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public KeyRequestInfo getRequestInfo(@PathParam("id") RequestId id); + public Response getRequestInfo(@PathParam("id") RequestId id); @POST @Path("{id}/approve") - public void approveRequest(@PathParam("id") RequestId id); + @ClientResponseType(entityType=Void.class) + public Response approveRequest(@PathParam("id") RequestId id); @POST @Path("{id}/reject") - public void rejectRequest(@PathParam("id") RequestId id); + @ClientResponseType(entityType=Void.class) + public Response rejectRequest(@PathParam("id") RequestId id); @POST @Path("{id}/cancel") - public void cancelRequest(@PathParam("id") RequestId id); - + @ClientResponseType(entityType=Void.class) + public Response cancelRequest(@PathParam("id") RequestId id); } diff --git a/base/server/cms/src/com/netscape/cms/servlet/request/KeyRequestService.java b/base/server/cms/src/com/netscape/cms/servlet/request/KeyRequestService.java index a81ca0acb..b85978a34 100644 --- a/base/server/cms/src/com/netscape/cms/servlet/request/KeyRequestService.java +++ b/base/server/cms/src/com/netscape/cms/servlet/request/KeyRequestService.java @@ -136,7 +136,7 @@ public class KeyRequestService extends PKIService implements KeyRequestResource * Used to retrieve key request info for a specific request */ @Override - public KeyRequestInfo getRequestInfo(RequestId id) { + public Response getRequestInfo(RequestId id) { if (id == null) { CMS.debug("getRequestInfo: is is null"); throw new BadRequestException("Unable to get Request: invalid ID"); @@ -155,7 +155,7 @@ public class KeyRequestService extends PKIService implements KeyRequestResource // request does not exist throw new RequestNotFoundException(id); } - return info; + return createOKResponse(info); } public Response archiveKey(KeyArchivalRequest data) { @@ -251,7 +251,7 @@ public class KeyRequestService extends PKIService implements KeyRequestResource } @Override - public void approveRequest(RequestId id) { + public Response approveRequest(RequestId id) { if (id == null) { throw new BadRequestException("Invalid request id."); } @@ -272,10 +272,12 @@ public class KeyRequestService extends PKIService implements KeyRequestResource auditRecoveryRequestChange(id, ILogger.FAILURE, "approve"); throw new PKIException(e.toString()); } + + return createNoContentResponse(); } @Override - public void rejectRequest(RequestId id) { + public Response rejectRequest(RequestId id) { if (id == null) { throw new BadRequestException("Invalid request id."); } @@ -289,10 +291,12 @@ public class KeyRequestService extends PKIService implements KeyRequestResource auditRecoveryRequestChange(id, ILogger.FAILURE, "reject"); throw new PKIException(e.toString()); } + + return createNoContentResponse(); } @Override - public void cancelRequest(RequestId id) { + public Response cancelRequest(RequestId id) { if (id == null) { throw new BadRequestException("Invalid request id."); } @@ -306,13 +310,15 @@ public class KeyRequestService extends PKIService implements KeyRequestResource auditRecoveryRequestChange(id, ILogger.FAILURE, "cancel"); throw new PKIException(e.toString()); } + + return createNoContentResponse(); } /** * Used to generate list of key requests based on the search parameters */ @Override - public KeyRequestInfoCollection listRequests(String requestState, String requestType, String clientID, + public Response listRequests(String requestState, String requestType, String clientID, RequestId start, Integer pageSize, Integer maxResults, Integer maxTime) { // auth and authz @@ -334,7 +340,7 @@ public class KeyRequestService extends PKIService implements KeyRequestResource e.printStackTrace(); throw new PKIException(e.toString()); } - return requests; + return createOKResponse(requests); } private String createSearchFilter(String requestState, String requestType, String clientID) { |