>From e6a3845621311bce541b48caa1c343c518e4b0e9 Mon Sep 17 00:00:00 2001
From: Ade Lee <alee@redhat.com>
Date: Tue, 24 Jul 2012 12:02:08 -0400
Subject: [PATCH] Use only pluralized REST interface URLs

---
 .../netscape/cms/servlet/test/CARestClient.java    |   21 +---
 .../ca/CertificateAuthorityApplication.java        |    6 --
 .../netscape/cms/client/cert/CertRestClient.java   |    9 +-
 .../netscape/cms/servlet/cert/CertResource.java    |   24 ++++-
 .../cms/servlet/cert/CertResourceService.java      |   83 +++++++++++++--
 .../netscape/cms/servlet/cert/CertsResource.java   |   36 -------
 .../cms/servlet/cert/CertsResourceService.java     |  111 --------------------
 .../com/netscape/cms/servlet/key/KeyResource.java  |   17 ++-
 .../cms/servlet/key/KeyResourceService.java        |   50 +++++++++
 .../com/netscape/cms/servlet/key/KeysResource.java |   23 ----
 .../cms/servlet/key/KeysResourceService.java       |   86 ---------------
 .../cms/servlet/profile/ProfileResource.java       |    7 +-
 .../servlet/profile/ProfileResourceService.java    |    9 +-
 .../cms/servlet/profile/ProfilesResource.java      |   34 ------
 .../servlet/profile/ProfilesResourceService.java   |   38 -------
 .../cms/servlet/request/CertRequestResource.java   |   21 +++-
 .../request/CertRequestResourceService.java        |   55 ++++++++++
 .../cms/servlet/request/CertRequestsResource.java  |   50 ---------
 .../request/CertRequestsResourceService.java       |   88 ----------------
 .../cms/servlet/request/KeyRequestResource.java    |   26 ++++-
 .../servlet/request/KeyRequestResourceService.java |   62 +++++++++++
 .../cms/servlet/request/KeyRequestsResource.java   |   34 ------
 .../request/KeyRequestsResourceService.java        |   96 -----------------
 base/kra/functional/drmclient.py                   |   12 +--
 .../netscape/cms/servlet/test/DRMRestClient.java   |   12 +--
 .../kra/KeyRecoveryAuthorityApplication.java       |    4 -
 26 files changed, 353 insertions(+), 661 deletions(-)
 delete mode 100644 base/common/src/com/netscape/cms/servlet/cert/CertsResource.java
 delete mode 100644 base/common/src/com/netscape/cms/servlet/cert/CertsResourceService.java
 delete mode 100644 base/common/src/com/netscape/cms/servlet/key/KeysResource.java
 delete mode 100644 base/common/src/com/netscape/cms/servlet/key/KeysResourceService.java
 delete mode 100644 base/common/src/com/netscape/cms/servlet/profile/ProfilesResource.java
 delete mode 100644 base/common/src/com/netscape/cms/servlet/profile/ProfilesResourceService.java
 delete mode 100644 base/common/src/com/netscape/cms/servlet/request/CertRequestsResource.java
 delete mode 100644 base/common/src/com/netscape/cms/servlet/request/CertRequestsResourceService.java
 delete mode 100644 base/common/src/com/netscape/cms/servlet/request/KeyRequestsResource.java
 delete mode 100644 base/common/src/com/netscape/cms/servlet/request/KeyRequestsResourceService.java

diff --git a/base/ca/functional/src/com/netscape/cms/servlet/test/CARestClient.java b/base/ca/functional/src/com/netscape/cms/servlet/test/CARestClient.java
index d5ea52b370ee661092d204e2624e974aaaadb30a..ffd3330cf4c8f8bf1b8d0fc2e749d9349df3b7c4 100644
--- a/base/ca/functional/src/com/netscape/cms/servlet/test/CARestClient.java
+++ b/base/ca/functional/src/com/netscape/cms/servlet/test/CARestClient.java
@@ -25,17 +25,14 @@ import org.jboss.resteasy.client.ProxyFactory;
 import com.netscape.certsrv.dbs.certdb.CertId;
 import com.netscape.certsrv.request.RequestId;
 import com.netscape.cms.servlet.cert.CertResource;
-import com.netscape.cms.servlet.cert.CertsResource;
 import com.netscape.cms.servlet.cert.model.CertDataInfos;
 import com.netscape.cms.servlet.cert.model.CertSearchData;
 import com.netscape.cms.servlet.cert.model.CertificateData;
 import com.netscape.cms.servlet.csadmin.CMSRestClient;
 import com.netscape.cms.servlet.profile.ProfileResource;
-import com.netscape.cms.servlet.profile.ProfilesResource;
 import com.netscape.cms.servlet.profile.model.ProfileData;
 import com.netscape.cms.servlet.profile.model.ProfileDataInfos;
 import com.netscape.cms.servlet.request.CertRequestResource;
-import com.netscape.cms.servlet.request.CertRequestsResource;
 import com.netscape.cms.servlet.request.model.AgentEnrollmentRequestData;
 import com.netscape.cms.servlet.request.model.CertRequestInfo;
 import com.netscape.cms.servlet.request.model.CertRequestInfos;
@@ -44,30 +41,20 @@ import com.netscape.cms.servlet.request.model.EnrollmentRequestData;
 public class CARestClient extends CMSRestClient {
 
     private CertResource certClient;
-    private CertsResource certsClient;
-    private CertRequestsResource certRequestsClient;
     private CertRequestResource certRequestClient;
-    private ProfilesResource profilesClient;
     private ProfileResource profileClient;
 
     public CARestClient(String baseUri, String clientCertNick) throws URISyntaxException {
-
         super(baseUri, clientCertNick);
-
-        certRequestsClient = ProxyFactory.create(CertRequestsResource.class, uri, executor, providerFactory);
         certRequestClient = ProxyFactory.create(CertRequestResource.class, uri, executor, providerFactory);
-
-        certsClient = ProxyFactory.create(CertsResource.class, uri, executor, providerFactory);
         certClient = ProxyFactory.create(CertResource.class, uri, executor, providerFactory);
-        profilesClient = ProxyFactory.create(ProfilesResource.class, uri, executor, providerFactory);
         profileClient = ProxyFactory.create(ProfileResource.class, uri, executor, providerFactory);
     }
 
     public Collection<CertRequestInfo> listRequests(String requestState, String requestType) {
-
         CertRequestInfos infos = null;
         Collection<CertRequestInfo> list = null;
-        infos = certRequestsClient.listRequests(
+        infos = certRequestClient.listRequests(
                 requestState, requestType, new RequestId(0), 100, 100, 10);
         list = infos.getRequests();
 
@@ -75,15 +62,15 @@ public class CARestClient extends CMSRestClient {
     }
 
     public CertDataInfos listCerts(String status) {
-        return certsClient.listCerts(status, 100, 10);
+        return certClient.listCerts(status, 100, 10);
     }
 
     public CertDataInfos searchCerts(CertSearchData data) {
-        return certsClient.searchCerts(data, 100, 10);
+        return certClient.searchCerts(data, 100, 10);
     }
 
     public ProfileDataInfos listProfiles() {
-        return profilesClient.listProfiles();
+        return profileClient.listProfiles();
     }
 
     public ProfileData getProfile(String id) {
diff --git a/base/ca/src/com/netscape/ca/CertificateAuthorityApplication.java b/base/ca/src/com/netscape/ca/CertificateAuthorityApplication.java
index 2a0ca8e6bdc1e6d7b5e60f378212314eb65d6759..d539bdb44ad6d13bc83e1676e0c4e9833b01e492 100644
--- a/base/ca/src/com/netscape/ca/CertificateAuthorityApplication.java
+++ b/base/ca/src/com/netscape/ca/CertificateAuthorityApplication.java
@@ -12,12 +12,9 @@ import com.netscape.cms.servlet.admin.UserCertResourceService;
 import com.netscape.cms.servlet.admin.UserResourceService;
 import com.netscape.cms.servlet.base.CMSException;
 import com.netscape.cms.servlet.cert.CertResourceService;
-import com.netscape.cms.servlet.cert.CertsResourceService;
 import com.netscape.cms.servlet.csadmin.SystemConfigurationResourceService;
 import com.netscape.cms.servlet.profile.ProfileResourceService;
-import com.netscape.cms.servlet.profile.ProfilesResourceService;
 import com.netscape.cms.servlet.request.CertRequestResourceService;
-import com.netscape.cms.servlet.request.CertRequestsResourceService;
 
 public class CertificateAuthorityApplication extends Application {
     private Set<Object> singletons = new HashSet<Object>();
@@ -28,14 +25,11 @@ public class CertificateAuthorityApplication extends Application {
         classes.add(SystemConfigurationResourceService.class);
 
         // certs and requests
-        classes.add(CertsResourceService.class);
         classes.add(CertResourceService.class);
-        classes.add(CertRequestsResourceService.class);
         classes.add(CertRequestResourceService.class);
 
         // profile management
         classes.add(ProfileResourceService.class);
-        classes.add(ProfilesResourceService.class);
 
         // user and group management
         classes.add(GroupMemberResourceService.class);
diff --git a/base/common/src/com/netscape/cms/client/cert/CertRestClient.java b/base/common/src/com/netscape/cms/client/cert/CertRestClient.java
index 4ddc1d77a5ed2ad4a8c95dfc677cd94dbd9bbb2d..ba4c2fb0443eb575a6bc539a65290819be21ac0f 100644
--- a/base/common/src/com/netscape/cms/client/cert/CertRestClient.java
+++ b/base/common/src/com/netscape/cms/client/cert/CertRestClient.java
@@ -21,7 +21,6 @@ import java.net.URISyntaxException;
 
 import com.netscape.certsrv.dbs.certdb.CertId;
 import com.netscape.cms.servlet.cert.CertResource;
-import com.netscape.cms.servlet.cert.CertsResource;
 import com.netscape.cms.servlet.cert.model.CertDataInfos;
 import com.netscape.cms.servlet.cert.model.CertRevokeRequest;
 import com.netscape.cms.servlet.cert.model.CertSearchData;
@@ -39,7 +38,6 @@ import com.netscape.cms.servlet.request.model.EnrollmentRequestData;
 public class CertRestClient extends CMSRestClient {
 
     public CertResource certClient;
-    public CertsResource certsClient;
     public CertRequestResource certRequestResource;
 
     public CertRestClient(String baseUri) throws URISyntaxException {
@@ -50,7 +48,6 @@ public class CertRestClient extends CMSRestClient {
         super(baseUri, nickname);
 
         certClient = createProxy(CertResource.class);
-        certsClient = createProxy(CertsResource.class);
         certRequestResource = createProxy(CertRequestResource.class);
     }
 
@@ -59,10 +56,10 @@ public class CertRestClient extends CMSRestClient {
     }
 
     public CertDataInfos findCerts(CertSearchData searchData) {
-        return certsClient.searchCerts(
+        return certClient.searchCerts(
                 searchData,
-                CertsResource.DEFAULT_MAXRESULTS,
-                CertsResource.DEFAULT_MAXTIME);
+                CertResource.DEFAULT_MAXRESULTS,
+                CertResource.DEFAULT_MAXTIME);
     }
 
     public CertRequestInfo revokeCert(CertId id, CertRevokeRequest request) {
diff --git a/base/common/src/com/netscape/cms/servlet/cert/CertResource.java b/base/common/src/com/netscape/cms/servlet/cert/CertResource.java
index 1c99b31477d9d67d57d7b6c8dfc18d34a6f705cf..74e02c3ea9859a109e4c073922da2c6a9b64160b 100644
--- a/base/common/src/com/netscape/cms/servlet/cert/CertResource.java
+++ b/base/common/src/com/netscape/cms/servlet/cert/CertResource.java
@@ -1,21 +1,43 @@
 package com.netscape.cms.servlet.cert;
 
 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.PathParam;
 import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
 
 import com.netscape.certsrv.dbs.certdb.CertId;
+import com.netscape.cms.servlet.cert.model.CertDataInfos;
 import com.netscape.cms.servlet.cert.model.CertRevokeRequest;
+import com.netscape.cms.servlet.cert.model.CertSearchData;
 import com.netscape.cms.servlet.cert.model.CertUnrevokeRequest;
 import com.netscape.cms.servlet.cert.model.CertificateData;
 import com.netscape.cms.servlet.request.model.CertRequestInfo;
 
-@Path("/cert")
+@Path("/certs")
 public interface CertResource {
+    public static final int DEFAULT_MAXTIME = 10;
+    public static final int DEFAULT_MAXRESULTS = 100;
+
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.TEXT_XML })
+    public CertDataInfos listCerts(
+                                 @QueryParam("status") String status,
+                                 @DefaultValue(""+DEFAULT_MAXRESULTS) @QueryParam("maxResults") int maxResults,
+                                 @DefaultValue(""+DEFAULT_MAXTIME) @QueryParam("maxTime") int maxTime);
+
+    @POST
+    @Path("search")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.TEXT_XML })
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    public CertDataInfos searchCerts(
+                                CertSearchData data,
+                                @DefaultValue(""+DEFAULT_MAXRESULTS) @QueryParam("maxResults") int maxResults,
+                                @DefaultValue(""+DEFAULT_MAXTIME) @QueryParam("maxTime") int maxTime);
 
     @GET
     @Path("{id}")
diff --git a/base/common/src/com/netscape/cms/servlet/cert/CertResourceService.java b/base/common/src/com/netscape/cms/servlet/cert/CertResourceService.java
index 9c25a626a299c25e5b700d2f0183a26e85397704..6dbfee3226b14aae4708ce3305af2bb51d88e364 100644
--- a/base/common/src/com/netscape/cms/servlet/cert/CertResourceService.java
+++ b/base/common/src/com/netscape/cms/servlet/cert/CertResourceService.java
@@ -23,6 +23,9 @@ import java.math.BigInteger;
 import java.security.cert.CertificateEncodingException;
 import java.security.cert.X509Certificate;
 
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+
 import netscape.security.x509.RevocationReason;
 import netscape.security.x509.X509CertImpl;
 
@@ -40,13 +43,16 @@ import com.netscape.cms.servlet.base.CMSException;
 import com.netscape.cms.servlet.base.CMSResourceService;
 import com.netscape.cms.servlet.base.UnauthorizedException;
 import com.netscape.cms.servlet.cert.model.CertDAO;
+import com.netscape.cms.servlet.cert.model.CertDataInfos;
 import com.netscape.cms.servlet.cert.model.CertRevokeRequest;
+import com.netscape.cms.servlet.cert.model.CertSearchData;
 import com.netscape.cms.servlet.cert.model.CertUnrevokeRequest;
 import com.netscape.cms.servlet.cert.model.CertificateData;
 import com.netscape.cms.servlet.processors.Processor;
 import com.netscape.cms.servlet.request.model.CertRequestDAO;
 import com.netscape.cms.servlet.request.model.CertRequestInfo;
 import com.netscape.cms.servlet.request.model.CertRetrievalRequestData;
+import com.netscape.cmsutil.ldap.LDAPUtil;
 
 /**
  * @author alee
@@ -60,13 +66,6 @@ public class CertResourceService extends CMSResourceService implements CertResou
         authority = (ICertificateAuthority) CMS.getSubsystem("ca");
     }
 
-    public CertDAO createDAO() {
-        CertDAO dao = new CertDAO();
-        dao.setLocale(getLocale());
-        dao.setUriInfo(uriInfo);
-        return dao;
-    }
-
     private void validateRequest(CertId id) {
 
         if (id == null) {
@@ -278,4 +277,74 @@ public class CertResourceService extends CMSResourceService implements CertResou
             throw new CMSException(e.getMessage());
         }
     }
+
+    public CertDAO createDAO() {
+        CertDAO dao = new CertDAO();
+        dao.setLocale(getLocale());
+        dao.setUriInfo(uriInfo);
+        return dao;
+    }
+
+    private String createSearchFilter(String status) {
+        String filter = "";
+
+        if ((status == null)) {
+            filter = "(serialno=*)";
+            return filter;
+        }
+
+        if (status != null) {
+            filter += "(certStatus=" + LDAPUtil.escapeFilter(status) + ")";
+        }
+
+        return filter;
+    }
+
+    private String createSearchFilter(CertSearchData data) {
+
+        if (data == null) {
+            return null;
+        }
+
+        return data.buildFilter();
+
+    }
+
+    @Override
+    public CertDataInfos listCerts(String status, int maxResults, int maxTime) {
+
+        // get ldap filter
+        String filter = createSearchFilter(status);
+        CMS.debug("listKeys: filter is " + filter);
+
+        CertDAO dao = createDAO();
+        CertDataInfos infos;
+        try {
+            infos = dao.listCerts(filter, maxResults, maxTime);
+        } catch (EBaseException e) {
+            e.printStackTrace();
+            throw new CMSException("Error listing certs in CertsResourceService.listCerts!");
+        }
+        return infos;
+    }
+
+    @Override
+    public CertDataInfos searchCerts(CertSearchData data, int maxResults, int maxTime) {
+
+        if (data == null) {
+            throw new WebApplicationException(Response.Status.BAD_REQUEST);
+        }
+        String filter = createSearchFilter(data);
+        CertDAO dao = createDAO();
+        CertDataInfos infos;
+
+        try {
+            infos = dao.listCerts(filter, maxResults, maxTime);
+        } catch (EBaseException e) {
+            e.printStackTrace();
+            throw new CMSException("Error listing certs in CertsResourceService.listCerts!");
+        }
+
+        return infos;
+    }
 }
diff --git a/base/common/src/com/netscape/cms/servlet/cert/CertsResource.java b/base/common/src/com/netscape/cms/servlet/cert/CertsResource.java
deleted file mode 100644
index dad4c65408952a9488e953ee72640f11b837d38c..0000000000000000000000000000000000000000
--- a/base/common/src/com/netscape/cms/servlet/cert/CertsResource.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.netscape.cms.servlet.cert;
-
-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 com.netscape.cms.servlet.cert.model.CertDataInfos;
-import com.netscape.cms.servlet.cert.model.CertSearchData;
-
-@Path("/certs")
-public interface CertsResource {
-    public static final int DEFAULT_MAXTIME = 10;
-    public static final int DEFAULT_MAXRESULTS = 100;
-
-    @GET
-    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.TEXT_XML })
-    public CertDataInfos listCerts(
-                                 @QueryParam("status") String status,
-                                 @DefaultValue(""+DEFAULT_MAXRESULTS) @QueryParam("maxResults") int maxResults,
-                                 @DefaultValue(""+DEFAULT_MAXTIME) @QueryParam("maxTime") int maxTime);
-
-    @POST
-    @Path("search")
-    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.TEXT_XML })
-    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-    public CertDataInfos searchCerts(
-                                CertSearchData data,
-                                @DefaultValue(""+DEFAULT_MAXRESULTS) @QueryParam("maxResults") int maxResults,
-                                @DefaultValue(""+DEFAULT_MAXTIME) @QueryParam("maxTime") int maxTime);
-
-}
diff --git a/base/common/src/com/netscape/cms/servlet/cert/CertsResourceService.java b/base/common/src/com/netscape/cms/servlet/cert/CertsResourceService.java
deleted file mode 100644
index 60daee11ffc79abc4baa02393cbb104fca2bf40c..0000000000000000000000000000000000000000
--- a/base/common/src/com/netscape/cms/servlet/cert/CertsResourceService.java
+++ /dev/null
@@ -1,111 +0,0 @@
-// --- BEGIN COPYRIGHT BLOCK ---
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-//
-// (C) 2011 Red Hat, Inc.
-// All rights reserved.
-// --- END COPYRIGHT BLOCK ---
-/**
- *
- */
-package com.netscape.cms.servlet.cert;
-
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Response;
-
-import com.netscape.certsrv.apps.CMS;
-import com.netscape.certsrv.base.EBaseException;
-import com.netscape.cms.servlet.base.CMSException;
-import com.netscape.cms.servlet.base.CMSResourceService;
-import com.netscape.cms.servlet.cert.model.CertDAO;
-import com.netscape.cms.servlet.cert.model.CertDataInfos;
-import com.netscape.cms.servlet.cert.model.CertSearchData;
-import com.netscape.cmsutil.ldap.LDAPUtil;
-
-/**
- * @author alee
- *
- */
-public class CertsResourceService extends CMSResourceService implements CertsResource {
-
-    public CertDAO createDAO() {
-        CertDAO dao = new CertDAO();
-        dao.setLocale(getLocale());
-        dao.setUriInfo(uriInfo);
-        return dao;
-    }
-
-    private String createSearchFilter(String status) {
-        String filter = "";
-
-        if ((status == null)) {
-            filter = "(serialno=*)";
-            return filter;
-        }
-
-        if (status != null) {
-            filter += "(certStatus=" + LDAPUtil.escapeFilter(status) + ")";
-        }
-
-        return filter;
-    }
-
-    private String createSearchFilter(CertSearchData data) {
-
-        if (data == null) {
-            return null;
-        }
-
-        return data.buildFilter();
-
-    }
-
-    @Override
-    public CertDataInfos listCerts(String status, int maxResults, int maxTime) {
-
-        // get ldap filter
-        String filter = createSearchFilter(status);
-        CMS.debug("listKeys: filter is " + filter);
-
-        CertDAO dao = createDAO();
-        CertDataInfos infos;
-        try {
-            infos = dao.listCerts(filter, maxResults, maxTime);
-        } catch (EBaseException e) {
-            e.printStackTrace();
-            throw new CMSException("Error listing certs in CertsResourceService.listCerts!");
-        }
-        return infos;
-    }
-
-    @Override
-    public CertDataInfos searchCerts(CertSearchData data, int maxResults, int maxTime) {
-
-        if (data == null) {
-            throw new WebApplicationException(Response.Status.BAD_REQUEST);
-        }
-        String filter = createSearchFilter(data);
-        CertDAO dao = createDAO();
-        CertDataInfos infos;
-
-        try {
-            infos = dao.listCerts(filter, maxResults, maxTime);
-        } catch (EBaseException e) {
-            e.printStackTrace();
-            throw new CMSException("Error listing certs in CertsResourceService.listCerts!");
-        }
-
-        return infos;
-    }
-
-}
diff --git a/base/common/src/com/netscape/cms/servlet/key/KeyResource.java b/base/common/src/com/netscape/cms/servlet/key/KeyResource.java
index 13960b23ea353dd90b9e0aa622c0e49e7b796304..9a9b5db1a9aafb412fe5f4b1444defdf09c2d6fe 100644
--- a/base/common/src/com/netscape/cms/servlet/key/KeyResource.java
+++ b/base/common/src/com/netscape/cms/servlet/key/KeyResource.java
@@ -1,18 +1,33 @@
 package com.netscape.cms.servlet.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;
 
 import com.netscape.cms.servlet.key.model.KeyData;
+import com.netscape.cms.servlet.key.model.KeyDataInfos;
 import com.netscape.cms.servlet.request.model.RecoveryRequestData;
 
-@Path("/key")
+@Path("/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, MediaType.TEXT_XML })
+    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
diff --git a/base/common/src/com/netscape/cms/servlet/key/KeyResourceService.java b/base/common/src/com/netscape/cms/servlet/key/KeyResourceService.java
index e475591a56beb1bbe3e9773f38cc5d1235e1b875..75fb886dfa36790a8ead11ee7be285c8afb947fd 100644
--- a/base/common/src/com/netscape/cms/servlet/key/KeyResourceService.java
+++ b/base/common/src/com/netscape/cms/servlet/key/KeyResourceService.java
@@ -23,6 +23,7 @@ import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
 
+import com.netscape.certsrv.apps.CMS;
 import com.netscape.certsrv.base.EBaseException;
 import com.netscape.certsrv.dbs.keydb.KeyId;
 import com.netscape.certsrv.request.IRequest;
@@ -31,9 +32,11 @@ import com.netscape.certsrv.request.RequestStatus;
 import com.netscape.cms.servlet.base.CMSResourceService;
 import com.netscape.cms.servlet.key.model.KeyDAO;
 import com.netscape.cms.servlet.key.model.KeyData;
+import com.netscape.cms.servlet.key.model.KeyDataInfos;
 import com.netscape.cms.servlet.request.model.KeyRequestDAO;
 import com.netscape.cms.servlet.request.model.KeyRequestInfo;
 import com.netscape.cms.servlet.request.model.RecoveryRequestData;
+import com.netscape.cmsutil.ldap.LDAPUtil;
 
 /**
  * @author alee
@@ -121,4 +124,51 @@ public class KeyResourceService extends CMSResourceService implements KeyResourc
         return reqInfo.getKeyId();
     }
 
+    /**
+     * Used to generate list of key infos based on the search parameters
+     */
+    public KeyDataInfos listKeys(String clientID, String status, int maxResults, int maxTime) {
+        // auth and authz
+
+        // get ldap filter
+        String filter = createSearchFilter(status, clientID);
+        CMS.debug("listKeys: filter is " + filter);
+
+        KeyDAO dao = new KeyDAO();
+        KeyDataInfos infos;
+        try {
+            infos = dao.listKeys(filter, maxResults, maxTime, uriInfo);
+        } catch (EBaseException e) {
+            e.printStackTrace();
+            throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
+        }
+        return infos;
+    }
+
+    private String createSearchFilter(String status, String clientID) {
+        String filter = "";
+        int matches = 0;
+
+        if ((status == null) && (clientID == null)) {
+            filter = "(serialno=*)";
+            return filter;
+        }
+
+        if (status != null) {
+            filter += "(status=" + LDAPUtil.escapeFilter(status) + ")";
+            matches ++;
+        }
+
+        if (clientID != null) {
+            filter += "(clientID=" + LDAPUtil.escapeFilter(clientID) + ")";
+            matches ++;
+        }
+
+        if (matches > 1) {
+            filter = "(&" + filter + ")";
+        }
+
+        return filter;
+    }
+
 }
diff --git a/base/common/src/com/netscape/cms/servlet/key/KeysResource.java b/base/common/src/com/netscape/cms/servlet/key/KeysResource.java
deleted file mode 100644
index 67d29cc528e037f02144913a061303d18982bb68..0000000000000000000000000000000000000000
--- a/base/common/src/com/netscape/cms/servlet/key/KeysResource.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.netscape.cms.servlet.key;
-
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-import com.netscape.cms.servlet.key.model.KeyDataInfos;
-
-@Path("/keys")
-public interface KeysResource {
-    public static final int DEFAULT_MAXTIME = 10;
-    public static final int DEFAULT_MAXRESULTS = 100;
-
-    @GET
-    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.TEXT_XML })
-    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);
-
-}
diff --git a/base/common/src/com/netscape/cms/servlet/key/KeysResourceService.java b/base/common/src/com/netscape/cms/servlet/key/KeysResourceService.java
deleted file mode 100644
index c57710ce050b9698d74e3c9bfd26f139f582ba5b..0000000000000000000000000000000000000000
--- a/base/common/src/com/netscape/cms/servlet/key/KeysResourceService.java
+++ /dev/null
@@ -1,86 +0,0 @@
-// --- BEGIN COPYRIGHT BLOCK ---
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-//
-// (C) 2011 Red Hat, Inc.
-// All rights reserved.
-// --- END COPYRIGHT BLOCK ---
-/**
- *
- */
-package com.netscape.cms.servlet.key;
-
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Response;
-
-import com.netscape.certsrv.apps.CMS;
-import com.netscape.certsrv.base.EBaseException;
-import com.netscape.cms.servlet.base.CMSResourceService;
-import com.netscape.cms.servlet.key.model.KeyDAO;
-import com.netscape.cms.servlet.key.model.KeyDataInfos;
-import com.netscape.cmsutil.ldap.LDAPUtil;
-
-/**
- * @author alee
- *
- */
-public class KeysResourceService extends CMSResourceService implements KeysResource {
-
-    /**
-     * Used to generate list of key infos based on the search parameters
-     */
-    public KeyDataInfos listKeys(String clientID, String status, int maxResults, int maxTime) {
-        // auth and authz
-
-        // get ldap filter
-        String filter = createSearchFilter(status, clientID);
-        CMS.debug("listKeys: filter is " + filter);
-
-        KeyDAO dao = new KeyDAO();
-        KeyDataInfos infos;
-        try {
-            infos = dao.listKeys(filter, maxResults, maxTime, uriInfo);
-        } catch (EBaseException e) {
-            e.printStackTrace();
-            throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
-        }
-        return infos;
-    }
-
-    private String createSearchFilter(String status, String clientID) {
-        String filter = "";
-        int matches = 0;
-
-        if ((status == null) && (clientID == null)) {
-            filter = "(serialno=*)";
-            return filter;
-        }
-
-        if (status != null) {
-            filter += "(status=" + LDAPUtil.escapeFilter(status) + ")";
-            matches ++;
-        }
-
-        if (clientID != null) {
-            filter += "(clientID=" + LDAPUtil.escapeFilter(clientID) + ")";
-            matches ++;
-        }
-
-        if (matches > 1) {
-            filter = "(&" + filter + ")";
-        }
-
-        return filter;
-    }
-
-}
diff --git a/base/common/src/com/netscape/cms/servlet/profile/ProfileResource.java b/base/common/src/com/netscape/cms/servlet/profile/ProfileResource.java
index 38f7ee038df22c325f31412640146d6d04fe7005..e402aeadd39315ec1d78923df976796d131cc510 100644
--- a/base/common/src/com/netscape/cms/servlet/profile/ProfileResource.java
+++ b/base/common/src/com/netscape/cms/servlet/profile/ProfileResource.java
@@ -7,8 +7,9 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 
 import com.netscape.cms.servlet.profile.model.ProfileData;
+import com.netscape.cms.servlet.profile.model.ProfileDataInfos;
 
-@Path("/profile")
+@Path("/profiles")
 public interface ProfileResource {
 
     @GET
@@ -16,6 +17,10 @@ public interface ProfileResource {
     @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.TEXT_XML })
     public ProfileData retrieveProfile(@PathParam("id") String id);
 
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.TEXT_XML })
+    public ProfileDataInfos listProfiles();
+
     /**
      * Used to retrieve a key
      *
diff --git a/base/common/src/com/netscape/cms/servlet/profile/ProfileResourceService.java b/base/common/src/com/netscape/cms/servlet/profile/ProfileResourceService.java
index a9af6278f0affda5c2c8c648353b41d71665e138..7e8a32424989731cfcc75006df65eb79c933142f 100644
--- a/base/common/src/com/netscape/cms/servlet/profile/ProfileResourceService.java
+++ b/base/common/src/com/netscape/cms/servlet/profile/ProfileResourceService.java
@@ -21,6 +21,7 @@ package com.netscape.cms.servlet.profile;
 import com.netscape.cms.servlet.base.CMSResourceService;
 import com.netscape.cms.servlet.profile.model.ProfileDAO;
 import com.netscape.cms.servlet.profile.model.ProfileData;
+import com.netscape.cms.servlet.profile.model.ProfileDataInfos;
 
 /**
  * @author alee
@@ -29,12 +30,14 @@ import com.netscape.cms.servlet.profile.model.ProfileData;
 public class ProfileResourceService extends CMSResourceService implements ProfileResource {
     @Override
     public ProfileData retrieveProfile(String id) {
-
         ProfileData data = null;
         ProfileDAO dao = new ProfileDAO();
-
         data = dao.getProfile(id);
-
         return data;
     }
+
+    public ProfileDataInfos listProfiles() {
+        ProfileDAO dao = new ProfileDAO();
+        return dao.listProfiles(uriInfo);
+    }
 }
diff --git a/base/common/src/com/netscape/cms/servlet/profile/ProfilesResource.java b/base/common/src/com/netscape/cms/servlet/profile/ProfilesResource.java
deleted file mode 100644
index 68868ebe8e4691ccac871d22d45ddc5a4bf7f9c0..0000000000000000000000000000000000000000
--- a/base/common/src/com/netscape/cms/servlet/profile/ProfilesResource.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// --- BEGIN COPYRIGHT BLOCK ---
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-//
-// (C) 2007 Red Hat, Inc.
-// All rights reserved.
-// --- END COPYRIGHT BLOCK ---
-package com.netscape.cms.servlet.profile;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import com.netscape.cms.servlet.profile.model.ProfileDataInfos;
-
-@Path("/profiles")
-public interface ProfilesResource {
-
-    @GET
-    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.TEXT_XML })
-    public ProfileDataInfos listProfiles();
-
-}
diff --git a/base/common/src/com/netscape/cms/servlet/profile/ProfilesResourceService.java b/base/common/src/com/netscape/cms/servlet/profile/ProfilesResourceService.java
deleted file mode 100644
index f07fbdcc2ab891be3495d0538c9f4cd35cc00b2f..0000000000000000000000000000000000000000
--- a/base/common/src/com/netscape/cms/servlet/profile/ProfilesResourceService.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// --- BEGIN COPYRIGHT BLOCK ---
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-//
-// (C) 2011 Red Hat, Inc.
-// All rights reserved.
-// --- END COPYRIGHT BLOCK ---
-/**
- *
- */
-package com.netscape.cms.servlet.profile;
-
-import com.netscape.cms.servlet.base.CMSResourceService;
-import com.netscape.cms.servlet.profile.model.ProfileDAO;
-import com.netscape.cms.servlet.profile.model.ProfileDataInfos;
-
-/**
- * @author alee
- *
- */
-public class ProfilesResourceService extends CMSResourceService implements ProfilesResource {
-
-    public ProfileDataInfos listProfiles()
-    {
-        ProfileDAO dao = new ProfileDAO();
-        return dao.listProfiles(uriInfo);
-    }
-}
diff --git a/base/common/src/com/netscape/cms/servlet/request/CertRequestResource.java b/base/common/src/com/netscape/cms/servlet/request/CertRequestResource.java
index 7bb23dbd5f687c1f25e3184a6659c87b93d65ad6..f350747388f6b83a7b54560ce9b57a9490b09c62 100644
--- a/base/common/src/com/netscape/cms/servlet/request/CertRequestResource.java
+++ b/base/common/src/com/netscape/cms/servlet/request/CertRequestResource.java
@@ -18,11 +18,13 @@
 package com.netscape.cms.servlet.request;
 
 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.PathParam;
 import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 
@@ -32,9 +34,26 @@ import com.netscape.cms.servlet.request.model.CertRequestInfo;
 import com.netscape.cms.servlet.request.model.CertRequestInfos;
 import com.netscape.cms.servlet.request.model.EnrollmentRequestData;
 
-@Path("/certrequest")
+@Path("/certrequests")
 public interface CertRequestResource {
 
+    public static final int DEFAULT_START = 0;
+    public static final int DEFAULT_PAGESIZE = 20;
+    public static final int DEFAULT_MAXRESULTS = 100;
+    public static final int DEFAULT_MAXTIME = 10;
+
+    /**
+     * Used to generate list of cert requests based on the search parameters
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.TEXT_XML })
+    public CertRequestInfos listRequests(@QueryParam("requestState") String requestState,
+            @QueryParam("requestType") String requestType,
+            @DefaultValue("" + DEFAULT_START) @QueryParam("start") RequestId start,
+            @DefaultValue("" + DEFAULT_PAGESIZE) @QueryParam("pageSize") int pageSize,
+            @DefaultValue("" + DEFAULT_MAXRESULTS) @QueryParam("maxResults") int maxResults,
+            @DefaultValue("" + DEFAULT_MAXTIME) @QueryParam("maxTime") int maxTime);
+
     /**
      * Used to retrieve cert request info for a specific request
      */
diff --git a/base/common/src/com/netscape/cms/servlet/request/CertRequestResourceService.java b/base/common/src/com/netscape/cms/servlet/request/CertRequestResourceService.java
index b31d9961d0b485f4ec525e074405035b4f481659..47f63ff6ce3798b29198dcd61b8c43d522eeb235 100644
--- a/base/common/src/com/netscape/cms/servlet/request/CertRequestResourceService.java
+++ b/base/common/src/com/netscape/cms/servlet/request/CertRequestResourceService.java
@@ -40,6 +40,7 @@ import com.netscape.cms.servlet.request.model.CertRequestDAO;
 import com.netscape.cms.servlet.request.model.CertRequestInfo;
 import com.netscape.cms.servlet.request.model.CertRequestInfos;
 import com.netscape.cms.servlet.request.model.EnrollmentRequestData;
+import com.netscape.cmsutil.ldap.LDAPUtil;
 
 /**
  * @author alee
@@ -187,4 +188,58 @@ public class CertRequestResourceService extends CMSResourceService implements Ce
         return info;
     }
 
+    /**
+     * Used to generate list of cert requests based on the search parameters
+     */
+    public CertRequestInfos listRequests(String requestState, String requestType,
+            RequestId start, int pageSize, int maxResults, int maxTime) {
+        // auth and authz
+
+        // get ldap filter
+        String filter = createSearchFilter(requestState, requestType);
+        CMS.debug("listRequests: filter is " + filter);
+
+        // get start marker
+        if (start == null) {
+            start = new RequestId(CertRequestResource.DEFAULT_START);
+        }
+
+        CertRequestDAO reqDAO = new CertRequestDAO();
+        CertRequestInfos requests;
+        try {
+            requests =  reqDAO.listRequests(filter, start, pageSize, maxResults, maxTime, uriInfo);
+        } catch (EBaseException e) {
+            CMS.debug("listRequests: error in obtaining request results" + e);
+            e.printStackTrace();
+            throw new CMSException("Error listing cert requests!");
+        }
+        return requests;
+    }
+
+    private String createSearchFilter(String requestState, String requestType) {
+        String filter = "";
+        int matches = 0;
+
+        if ((requestState == null) && (requestType == null)) {
+            filter = "(requeststate=*)";
+            return filter;
+        }
+
+        if (requestState != null) {
+            filter += "(requeststate=" + LDAPUtil.escapeFilter(requestState) + ")";
+            matches++;
+        }
+
+        if (requestType != null) {
+            filter += "(requesttype=" + LDAPUtil.escapeFilter(requestType) + ")";
+            matches++;
+        }
+
+        if (matches > 1) {
+            filter = "(&" + filter + ")";
+        }
+
+        return filter;
+    }
+
 }
diff --git a/base/common/src/com/netscape/cms/servlet/request/CertRequestsResource.java b/base/common/src/com/netscape/cms/servlet/request/CertRequestsResource.java
deleted file mode 100644
index ec8e2679fcf4320f608ca81095cefd605fd61519..0000000000000000000000000000000000000000
--- a/base/common/src/com/netscape/cms/servlet/request/CertRequestsResource.java
+++ /dev/null
@@ -1,50 +0,0 @@
-// --- BEGIN COPYRIGHT BLOCK ---
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-//
-// (C) 2007 Red Hat, Inc.
-// All rights reserved.
-// --- END COPYRIGHT BLOCK ---
-package com.netscape.cms.servlet.request;
-
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-
-import com.netscape.certsrv.request.RequestId;
-import com.netscape.cms.servlet.request.model.CertRequestInfos;
-
-@Path("/certrequests")
-public interface CertRequestsResource {
-
-    public static final int DEFAULT_START = 0;
-    public static final int DEFAULT_PAGESIZE = 20;
-    public static final int DEFAULT_MAXRESULTS = 100;
-    public static final int DEFAULT_MAXTIME = 10;
-
-    /**
-     * Used to generate list of cert requests based on the search parameters
-     */
-    @GET
-    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.TEXT_XML })
-    public CertRequestInfos listRequests(@QueryParam("requestState") String requestState,
-            @QueryParam("requestType") String requestType,
-            @DefaultValue("" + DEFAULT_START) @QueryParam("start") RequestId start,
-            @DefaultValue("" + DEFAULT_PAGESIZE) @QueryParam("pageSize") int pageSize,
-            @DefaultValue("" + DEFAULT_MAXRESULTS) @QueryParam("maxResults") int maxResults,
-            @DefaultValue("" + DEFAULT_MAXTIME) @QueryParam("maxTime") int maxTime);
-
-}
\ No newline at end of file
diff --git a/base/common/src/com/netscape/cms/servlet/request/CertRequestsResourceService.java b/base/common/src/com/netscape/cms/servlet/request/CertRequestsResourceService.java
deleted file mode 100644
index 370bd126f055a4a96ab4b7c9033f662bd9b16cd2..0000000000000000000000000000000000000000
--- a/base/common/src/com/netscape/cms/servlet/request/CertRequestsResourceService.java
+++ /dev/null
@@ -1,88 +0,0 @@
-// --- BEGIN COPYRIGHT BLOCK ---
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-//
-// (C) 2011 Red Hat, Inc.
-// All rights reserved.
-// --- END COPYRIGHT BLOCK ---
-
-package com.netscape.cms.servlet.request;
-
-import com.netscape.certsrv.apps.CMS;
-import com.netscape.certsrv.base.EBaseException;
-import com.netscape.certsrv.request.RequestId;
-import com.netscape.cms.servlet.base.CMSException;
-import com.netscape.cms.servlet.base.CMSResourceService;
-import com.netscape.cms.servlet.request.model.CertRequestDAO;
-import com.netscape.cms.servlet.request.model.CertRequestInfos;
-import com.netscape.cmsutil.ldap.LDAPUtil;
-/**
- * @author alee
- *
- */
-public class CertRequestsResourceService extends CMSResourceService implements CertRequestsResource {
-
-    /**
-     * Used to generate list of cert requests based on the search parameters
-     */
-    public CertRequestInfos listRequests(String requestState, String requestType,
-            RequestId start, int pageSize, int maxResults, int maxTime) {
-        // auth and authz
-
-        // get ldap filter
-        String filter = createSearchFilter(requestState, requestType);
-        CMS.debug("listRequests: filter is " + filter);
-
-        // get start marker
-        if (start == null) {
-            start = new RequestId(CertRequestsResource.DEFAULT_START);
-        }
-
-        CertRequestDAO reqDAO = new CertRequestDAO();
-        CertRequestInfos requests;
-        try {
-            requests =  reqDAO.listRequests(filter, start, pageSize, maxResults, maxTime, uriInfo);
-        } catch (EBaseException e) {
-            CMS.debug("listRequests: error in obtaining request results" + e);
-            e.printStackTrace();
-            throw new CMSException("Error listing cert requests!");
-        }
-        return requests;
-    }
-
-    private String createSearchFilter(String requestState, String requestType) {
-        String filter = "";
-        int matches = 0;
-
-        if ((requestState == null) && (requestType == null)) {
-            filter = "(requeststate=*)";
-            return filter;
-        }
-
-        if (requestState != null) {
-            filter += "(requeststate=" + LDAPUtil.escapeFilter(requestState) + ")";
-            matches++;
-        }
-
-        if (requestType != null) {
-            filter += "(requesttype=" + LDAPUtil.escapeFilter(requestType) + ")";
-            matches++;
-        }
-
-        if (matches > 1) {
-            filter = "(&" + filter + ")";
-        }
-
-        return filter;
-    }
-}
diff --git a/base/common/src/com/netscape/cms/servlet/request/KeyRequestResource.java b/base/common/src/com/netscape/cms/servlet/request/KeyRequestResource.java
index cd08f46bbbdd6d8d6615bed1cdafa151b99c283c..cf326540daf6212baa071b2906282be44182c5ae 100644
--- a/base/common/src/com/netscape/cms/servlet/request/KeyRequestResource.java
+++ b/base/common/src/com/netscape/cms/servlet/request/KeyRequestResource.java
@@ -1,25 +1,47 @@
 package com.netscape.cms.servlet.request;
 
+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.PathParam;
 import javax.ws.rs.Produces;
-import javax.ws.rs.Consumes;
+import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 
 import com.netscape.certsrv.request.RequestId;
 import com.netscape.cms.servlet.request.model.ArchivalRequestData;
 import com.netscape.cms.servlet.request.model.KeyRequestInfo;
+import com.netscape.cms.servlet.request.model.KeyRequestInfos;
 import com.netscape.cms.servlet.request.model.RecoveryRequestData;
 
-@Path("/keyrequest")
+@Path("/keyrequests")
 public interface KeyRequestResource {
     public final String SYMMETRIC_KEY_TYPE = "symmetricKey";
     public final String PASS_PHRASE_TYPE = "passPhrase";
     public final String ASYMMETRIC_KEY_TYPE = "asymmetricKey";
 
+    public static final int DEFAULT_START = 0;
+    public static final int DEFAULT_PAGESIZE = 20;
+    public static final int DEFAULT_MAXRESULTS = 100;
+    public static final int DEFAULT_MAXTIME = 10;
+
+    /**
+     * Used to generate list of key requests based on the search parameters
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.TEXT_XML })
+    public KeyRequestInfos listRequests(@QueryParam("requestState") String requestState,
+                                            @QueryParam("requestType") String requestType,
+                                            @QueryParam("clientID") String clientID,
+                                            @DefaultValue(""+DEFAULT_START) @QueryParam("start") RequestId start,
+                                            @DefaultValue(""+DEFAULT_PAGESIZE) @QueryParam("pageSize") int pageSize,
+                                            @DefaultValue(""+DEFAULT_MAXRESULTS) @QueryParam("maxResults") int maxResults,
+                                            @DefaultValue(""+DEFAULT_MAXTIME) @QueryParam("maxTime") int maxTime);
+
+
     /**
      * Used to retrieve key request info for a specific request
      */
diff --git a/base/common/src/com/netscape/cms/servlet/request/KeyRequestResourceService.java b/base/common/src/com/netscape/cms/servlet/request/KeyRequestResourceService.java
index b9ba206c1ca40a097c9046c2f413385470b7d016..d98938b7a125b5e3f7affec0d9563529173ccf5e 100644
--- a/base/common/src/com/netscape/cms/servlet/request/KeyRequestResourceService.java
+++ b/base/common/src/com/netscape/cms/servlet/request/KeyRequestResourceService.java
@@ -22,6 +22,7 @@ import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
 
+import com.netscape.certsrv.apps.CMS;
 import com.netscape.certsrv.base.EBaseException;
 import com.netscape.certsrv.request.RequestId;
 import com.netscape.cms.servlet.base.CMSException;
@@ -29,7 +30,9 @@ import com.netscape.cms.servlet.base.CMSResourceService;
 import com.netscape.cms.servlet.request.model.ArchivalRequestData;
 import com.netscape.cms.servlet.request.model.KeyRequestDAO;
 import com.netscape.cms.servlet.request.model.KeyRequestInfo;
+import com.netscape.cms.servlet.request.model.KeyRequestInfos;
 import com.netscape.cms.servlet.request.model.RecoveryRequestData;
+import com.netscape.cmsutil.ldap.LDAPUtil;
 
 /**
  * @author alee
@@ -159,4 +162,63 @@ public class KeyRequestResourceService extends CMSResourceService implements Key
             throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
         }
     }
+
+    /**
+     * Used to generate list of key requests based on the search parameters
+     */
+    public KeyRequestInfos listRequests(String requestState, String requestType, String clientID,
+            RequestId start, int pageSize, int maxResults, int maxTime) {
+        // auth and authz
+
+        // get ldap filter
+        String filter = createSearchFilter(requestState, requestType, clientID);
+        CMS.debug("listRequests: filter is " + filter);
+
+        // get start marker
+        if (start == null) {
+            start = new RequestId(KeyRequestResource.DEFAULT_START);
+        }
+
+        KeyRequestDAO reqDAO = new KeyRequestDAO();
+        KeyRequestInfos requests;
+        try {
+            requests = reqDAO.listRequests(filter, start, pageSize, maxResults, maxTime, uriInfo);
+        } catch (EBaseException e) {
+            CMS.debug("listRequests: error in obtaining request results" + e);
+            e.printStackTrace();
+            throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
+        }
+        return requests;
+    }
+
+    private String createSearchFilter(String requestState, String requestType, String clientID) {
+        String filter = "";
+        int matches = 0;
+
+        if ((requestState == null) && (requestType == null) && (clientID == null)) {
+            filter = "(requeststate=*)";
+            return filter;
+        }
+
+        if (requestState != null) {
+            filter += "(requeststate=" + LDAPUtil.escapeFilter(requestState) + ")";
+            matches ++;
+        }
+
+        if (requestType != null) {
+            filter += "(requesttype=" + LDAPUtil.escapeFilter(requestType) + ")";
+            matches ++;
+        }
+
+        if (clientID != null) {
+            filter += "(clientID=" + LDAPUtil.escapeFilter(clientID) + ")";
+            matches ++;
+        }
+
+        if (matches > 1) {
+            filter = "(&" + filter + ")";
+        }
+
+        return filter;
+    }
 }
diff --git a/base/common/src/com/netscape/cms/servlet/request/KeyRequestsResource.java b/base/common/src/com/netscape/cms/servlet/request/KeyRequestsResource.java
deleted file mode 100644
index fd6bc4c27011b1fd9027d60d43f195adde7812ed..0000000000000000000000000000000000000000
--- a/base/common/src/com/netscape/cms/servlet/request/KeyRequestsResource.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.netscape.cms.servlet.request;
-
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-
-import com.netscape.certsrv.request.RequestId;
-import com.netscape.cms.servlet.request.model.KeyRequestInfos;
-
-@Path("/keyrequests")
-public interface KeyRequestsResource {
-
-    public static final int DEFAULT_START = 0;
-    public static final int DEFAULT_PAGESIZE = 20;
-    public static final int DEFAULT_MAXRESULTS = 100;
-    public static final int DEFAULT_MAXTIME = 10;
-
-    /**
-     * Used to generate list of key requests based on the search parameters
-     */
-    @GET
-    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.TEXT_XML })
-    public KeyRequestInfos listRequests(@QueryParam("requestState") String requestState,
-                                            @QueryParam("requestType") String requestType,
-                                            @QueryParam("clientID") String clientID,
-                                            @DefaultValue(""+DEFAULT_START) @QueryParam("start") RequestId start,
-                                            @DefaultValue(""+DEFAULT_PAGESIZE) @QueryParam("pageSize") int pageSize,
-                                            @DefaultValue(""+DEFAULT_MAXRESULTS) @QueryParam("maxResults") int maxResults,
-                                            @DefaultValue(""+DEFAULT_MAXTIME) @QueryParam("maxTime") int maxTime);
-
-}
diff --git a/base/common/src/com/netscape/cms/servlet/request/KeyRequestsResourceService.java b/base/common/src/com/netscape/cms/servlet/request/KeyRequestsResourceService.java
deleted file mode 100644
index 48218c4d2034c6b046ffb4cfe12cedb8c244e5b5..0000000000000000000000000000000000000000
--- a/base/common/src/com/netscape/cms/servlet/request/KeyRequestsResourceService.java
+++ /dev/null
@@ -1,96 +0,0 @@
-// --- BEGIN COPYRIGHT BLOCK ---
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-//
-// (C) 2011 Red Hat, Inc.
-// All rights reserved.
-// --- END COPYRIGHT BLOCK ---
-
-package com.netscape.cms.servlet.request;
-
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Response;
-
-import com.netscape.certsrv.apps.CMS;
-import com.netscape.certsrv.base.EBaseException;
-import com.netscape.certsrv.request.RequestId;
-import com.netscape.cms.servlet.base.CMSResourceService;
-import com.netscape.cms.servlet.request.model.KeyRequestDAO;
-import com.netscape.cms.servlet.request.model.KeyRequestInfos;
-import com.netscape.cmsutil.ldap.LDAPUtil;
-
-/**
- * @author alee
- *
- */
-public class KeyRequestsResourceService extends CMSResourceService implements KeyRequestsResource{
-
-    /**
-     * Used to generate list of key requests based on the search parameters
-     */
-    public KeyRequestInfos listRequests(String requestState, String requestType, String clientID,
-            RequestId start, int pageSize, int maxResults, int maxTime) {
-        // auth and authz
-
-        // get ldap filter
-        String filter = createSearchFilter(requestState, requestType, clientID);
-        CMS.debug("listRequests: filter is " + filter);
-
-        // get start marker
-        if (start == null) {
-            start = new RequestId(KeyRequestsResource.DEFAULT_START);
-        }
-
-        KeyRequestDAO reqDAO = new KeyRequestDAO();
-        KeyRequestInfos requests;
-        try {
-            requests = reqDAO.listRequests(filter, start, pageSize, maxResults, maxTime, uriInfo);
-        } catch (EBaseException e) {
-            CMS.debug("listRequests: error in obtaining request results" + e);
-            e.printStackTrace();
-            throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
-        }
-        return requests;
-    }
-
-    private String createSearchFilter(String requestState, String requestType, String clientID) {
-        String filter = "";
-        int matches = 0;
-
-        if ((requestState == null) && (requestType == null) && (clientID == null)) {
-            filter = "(requeststate=*)";
-            return filter;
-        }
-
-        if (requestState != null) {
-            filter += "(requeststate=" + LDAPUtil.escapeFilter(requestState) + ")";
-            matches ++;
-        }
-
-        if (requestType != null) {
-            filter += "(requesttype=" + LDAPUtil.escapeFilter(requestType) + ")";
-            matches ++;
-        }
-
-        if (clientID != null) {
-            filter += "(clientID=" + LDAPUtil.escapeFilter(clientID) + ")";
-            matches ++;
-        }
-
-        if (matches > 1) {
-            filter = "(&" + filter + ")";
-        }
-
-        return filter;
-    }
-}
diff --git a/base/kra/functional/drmclient.py b/base/kra/functional/drmclient.py
index e9b0ccb49ff203f56c23916eea11a47f77ae6e0a..62940fdf247bb81413dd2b44302acfdd147d5571 100644
--- a/base/kra/functional/drmclient.py
+++ b/base/kra/functional/drmclient.py
@@ -612,7 +612,7 @@ class kra:
         
         #Call CMS
         http_status, http_reason_phrase, http_headers, http_body = \
-            self._request('/kra/pki/keyrequest/archive',
+            self._request('/kra/pki/keyrequests/archive',
                          self.kra_agent_port,
                          self.POST,
                          etree.tostring(request.getroot(), encoding='UTF-8'))            
@@ -750,7 +750,7 @@ class kra:
         
         #Call CMS
         http_status, http_reason_phrase, http_headers, http_body = \
-            self._request('/kra/pki/keyrequest/recover',
+            self._request('/kra/pki/keyrequests/recover',
                          self.kra_agent_port,
                          self.POST,
                          etree.tostring(request.getroot(), encoding='UTF-8'))            
@@ -798,7 +798,7 @@ class kra:
         
         #Call CMS
         http_status, http_reason_phrase, http_headers, http_body = \
-            self._request('/kra/pki/keyrequest/approve/'+ request_id,
+            self._request('/kra/pki/keyrequests/approve/'+ request_id,
                          self.kra_agent_port,
                          self.POST,
                          None)            
@@ -820,7 +820,7 @@ class kra:
         
         #Call CMS
         http_status, http_reason_phrase, http_headers, http_body = \
-            self._request('/kra/pki/keyrequest/reject/'+ request_id,
+            self._request('/kra/pki/keyrequests/reject/'+ request_id,
                          self.kra_agent_port,
                          self.POST,
                          None)            
@@ -842,7 +842,7 @@ class kra:
         
         #Call CMS
         http_status, http_reason_phrase, http_headers, http_body = \
-            self._request('/kra/pki/keyrequest/cancel/'+ request_id,
+            self._request('/kra/pki/keyrequests/cancel/'+ request_id,
                          self.kra_agent_port,
                          self.POST,
                          None)            
@@ -898,7 +898,7 @@ class kra:
         
         #Call CMS
         http_status, http_reason_phrase, http_headers, http_body = \
-            self._request('/kra/pki/key/retrieve',
+            self._request('/kra/pki/keys/retrieve',
                          self.kra_agent_port,
                          self.POST,
                          etree.tostring(request.getroot(), encoding='UTF-8'))            
diff --git a/base/kra/functional/src/com/netscape/cms/servlet/test/DRMRestClient.java b/base/kra/functional/src/com/netscape/cms/servlet/test/DRMRestClient.java
index 5dbcac1a0a2a09a6d36904668ce37a8d2f023521..243e0d91cc74a0ac0f42f9a94c096ead56a2dd59 100644
--- a/base/kra/functional/src/com/netscape/cms/servlet/test/DRMRestClient.java
+++ b/base/kra/functional/src/com/netscape/cms/servlet/test/DRMRestClient.java
@@ -13,12 +13,10 @@ import com.netscape.cms.servlet.admin.SystemCertificateResource;
 import com.netscape.cms.servlet.cert.model.CertificateData;
 import com.netscape.cms.servlet.csadmin.CMSRestClient;
 import com.netscape.cms.servlet.key.KeyResource;
-import com.netscape.cms.servlet.key.KeysResource;
 import com.netscape.cms.servlet.key.model.KeyData;
 import com.netscape.cms.servlet.key.model.KeyDataInfo;
 import com.netscape.cms.servlet.key.model.KeyDataInfos;
 import com.netscape.cms.servlet.request.KeyRequestResource;
-import com.netscape.cms.servlet.request.KeyRequestsResource;
 import com.netscape.cms.servlet.request.model.ArchivalRequestData;
 import com.netscape.cms.servlet.request.model.KeyRequestInfo;
 import com.netscape.cms.servlet.request.model.KeyRequestInfos;
@@ -28,19 +26,13 @@ import com.netscape.cmsutil.util.Utils;
 public class DRMRestClient  extends CMSRestClient {
 
     private KeyResource keyClient;
-    private KeysResource keysClient;
-    private KeyRequestsResource keyRequestsClient;
     private KeyRequestResource keyRequestClient;
     private SystemCertificateResource systemCertClient;
 
     public DRMRestClient(String baseUri, String clientCertNick) throws URISyntaxException {
         super(baseUri,clientCertNick);
-
         systemCertClient = ProxyFactory.create(SystemCertificateResource.class, uri, executor, providerFactory);
-        keyRequestsClient = ProxyFactory.create(KeyRequestsResource.class, uri, executor, providerFactory);
         keyRequestClient = ProxyFactory.create(KeyRequestResource.class, uri, executor, providerFactory);
-        keysClient = ProxyFactory.create(KeysResource.class, uri, executor, providerFactory);
-        keyClient = ProxyFactory.create(KeyResource.class, uri, executor, providerFactory);
         keyClient = ProxyFactory.create(KeyResource.class, uri, executor, providerFactory);
     }
 
@@ -54,7 +46,7 @@ public class DRMRestClient  extends CMSRestClient {
     }
 
     public Collection<KeyRequestInfo> listRequests(String requestState, String requestType) {
-        KeyRequestInfos infos = keyRequestsClient.listRequests(
+        KeyRequestInfos infos = keyRequestClient.listRequests(
                 requestState, requestType, null, new RequestId(0), 100, 100, 10
                 );
         Collection<KeyRequestInfo> list = infos.getRequests();
@@ -74,7 +66,7 @@ public class DRMRestClient  extends CMSRestClient {
     }
 
     public KeyDataInfo getKeyData(String clientId, String status) {
-        KeyDataInfos infos = keysClient.listKeys(clientId, status, 100, 10);
+        KeyDataInfos infos = keyClient.listKeys(clientId, status, 100, 10);
         Collection<KeyDataInfo> list = infos.getKeyInfos();
         Iterator<KeyDataInfo> iter = list.iterator();
 
diff --git a/base/kra/src/com/netscape/kra/KeyRecoveryAuthorityApplication.java b/base/kra/src/com/netscape/kra/KeyRecoveryAuthorityApplication.java
index 0953f7de39e085cf08ccd80cb1142ebf260bf92c..612b0ff1886a5499fbd6f73dcc2e92d062ffa782 100644
--- a/base/kra/src/com/netscape/kra/KeyRecoveryAuthorityApplication.java
+++ b/base/kra/src/com/netscape/kra/KeyRecoveryAuthorityApplication.java
@@ -13,9 +13,7 @@ import com.netscape.cms.servlet.admin.UserResourceService;
 import com.netscape.cms.servlet.base.CMSException;
 import com.netscape.cms.servlet.csadmin.SystemConfigurationResourceService;
 import com.netscape.cms.servlet.key.KeyResourceService;
-import com.netscape.cms.servlet.key.KeysResourceService;
 import com.netscape.cms.servlet.request.KeyRequestResourceService;
-import com.netscape.cms.servlet.request.KeyRequestsResourceService;
 
 public class KeyRecoveryAuthorityApplication extends Application {
 
@@ -27,9 +25,7 @@ public class KeyRecoveryAuthorityApplication extends Application {
         classes.add(SystemConfigurationResourceService.class);
 
         // keys and keyrequests
-        classes.add(KeysResourceService.class);
         classes.add(KeyResourceService.class);
-        classes.add(KeyRequestsResourceService.class);
         classes.add(KeyRequestResourceService.class);
 
         // user and group management
-- 
1.7.10.1

