changeset 7:06e9e25632cd 0.1

Added a method to the HttpClient to list the collection of a user. http-client/trunk@1615 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 30 Mar 2011 07:48:39 +0000
parents 09a84c6e263a
children 77c09d0e2c2e
files ChangeLog src/main/java/de/intevation/artifacts/httpclient/http/HttpClient.java src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java
diffstat 3 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Mar 23 16:27:56 2011 +0000
+++ b/ChangeLog	Wed Mar 30 07:48:39 2011 +0000
@@ -1,3 +1,9 @@
+2011-03-30  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java,
+	  src/main/java/de/intevation/artifacts/httpclient/http/HttpClient.java:
+	  Added a new method to list the collection of a specific user.
+
 2011-03-23  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java,
--- a/src/main/java/de/intevation/artifacts/httpclient/http/HttpClient.java	Wed Mar 23 16:27:56 2011 +0000
+++ b/src/main/java/de/intevation/artifacts/httpclient/http/HttpClient.java	Wed Mar 30 07:48:39 2011 +0000
@@ -82,5 +82,8 @@
 
     Document listUsers()
     throws ConnectionException;
+
+    Document listUserCollections(String userid)
+    throws ConnectionException;
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- a/src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java	Wed Mar 23 16:27:56 2011 +0000
+++ b/src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java	Wed Mar 30 07:48:39 2011 +0000
@@ -45,6 +45,10 @@
     /** The URL part of the resource to list the existing users of the server.*/
     public static final String PATH_LIST_USERS = "/list-users";
 
+    /** The URL part of the resource to list the Collections owned by a specific
+     * user.*/
+    public static final String PATH_USER_COLLECTIONS = "/list-collections";
+
     /** The URL part of the resource to call a specific service.*/
     public static final String PATH_SERVICE = "/service";
 
@@ -335,5 +339,21 @@
             throw new ConnectionException(ioe.getMessage(), ioe);
         }
     }
+
+
+    public Document listUserCollections(String userid)
+    throws ConnectionException
+    {
+        ResponseHandler handler = new DocumentResponseHandler();
+
+        String url = serverUrl + PATH_USER_COLLECTIONS + "/" + userid;
+
+        try {
+            return (Document) handler.handle(doGet(url));
+        }
+        catch (IOException ioe) {
+            throw new ConnectionException(ioe.getMessage(), ioe);
+        }
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

http://dive4elements.wald.intevation.org