From 1aa02e5207514d210e903d23e1d698b85fc29344 Mon Sep 17 00:00:00 2001 From: Endi Sukma Dewata Date: Sat, 11 Aug 2012 09:47:39 -0500 Subject: Reorganized REST common classes. The common classes used by REST client and services have been moved into the com.netscape.certsrv. packages. Ticket #215 --- .../src/com/netscape/certsrv/key/KeyResource.java | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 base/common/src/com/netscape/certsrv/key/KeyResource.java (limited to 'base/common/src/com/netscape/certsrv/key/KeyResource.java') diff --git a/base/common/src/com/netscape/certsrv/key/KeyResource.java b/base/common/src/com/netscape/certsrv/key/KeyResource.java new file mode 100644 index 000000000..a499ca11f --- /dev/null +++ b/base/common/src/com/netscape/certsrv/key/KeyResource.java @@ -0,0 +1,45 @@ +package com.netscape.certsrv.key; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; + + +@Path("agent/keys") +public interface KeyResource { + + public static final int DEFAULT_MAXTIME = 10; + public static final int DEFAULT_MAXRESULTS = 100; + + @GET + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + public KeyDataInfos listKeys(@QueryParam("clientID") String clientID, + @QueryParam("status") String status, + @DefaultValue(""+DEFAULT_MAXRESULTS) @QueryParam("maxResults") int maxResults, + @DefaultValue(""+DEFAULT_MAXTIME) @QueryParam("maxTime") int maxTime); + + + /** + * Used to retrieve a key + * @param data + * @return + */ + @POST + @Path("retrieve") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + public KeyData retrieveKey(KeyRecoveryRequest data); + + // retrieval - used to test integration with a browser + @POST + @Path("retrieve") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Consumes({ MediaType.APPLICATION_FORM_URLENCODED }) + public KeyData retrieveKey(MultivaluedMap form); +} -- cgit