changeset 37:874c25363dc9 2.9

Added new method findUser to HttpClient With the new method it is possible to get a document by an account name. http-client/trunk@5259 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Ricks <bjoern.ricks@intevation.de>
date Fri, 24 Aug 2012 13:59:12 +0000
parents 60f50a2f0168
children 4b657996af7f
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	Fri Jul 27 06:41:57 2012 +0000
+++ b/ChangeLog	Fri Aug 24 13:59:12 2012 +0000
@@ -1,3 +1,10 @@
+2012-08-24	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java,
+	  src/main/java/de/intevation/artifacts/httpclient/http/HttpClient.java:
+	  Added new method findUser. With the new method it is possible to get a
+	  user document by an account name.
+
 2012-07-27  Ingo Weinzierl <ingo@intevation.de>
 
 	Taggd RELEASE 2.8.1
--- a/src/main/java/de/intevation/artifacts/httpclient/http/HttpClient.java	Fri Jul 27 06:41:57 2012 +0000
+++ b/src/main/java/de/intevation/artifacts/httpclient/http/HttpClient.java	Fri Aug 24 13:59:12 2012 +0000
@@ -109,5 +109,8 @@
 
     Document createUser(Document doc)
     throws ConnectionException;
+
+    Document findUser(Document doc)
+    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	Fri Jul 27 06:41:57 2012 +0000
+++ b/src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java	Fri Aug 24 13:59:12 2012 +0000
@@ -57,6 +57,9 @@
     /** The URL part og the resource to create a new user on the server.*/
     public static final String PATH_CREATE_USER = "/create-user";
 
+    /** The URL part og the resource to find an existing user on the server.*/
+    public static final String PATH_FIND_USER = "/find-user";
+
     /** The URL part of the resource to call a specific service.*/
     public static final String PATH_SERVICE = "/service";
 
@@ -554,5 +557,21 @@
                 "Connection to server failed: " + ioe.getMessage());
         }
     }
+
+    @Override
+    public Document findUser(Document doc)
+    throws ConnectionException {
+        ResponseHandler handler = new DocumentResponseHandler();
+
+        String url = this.serverUrl + PATH_FIND_USER;
+
+        try {
+            return (Document) handler.handle(doPost(url, doc));
+        }
+        catch (IOException ioe) {
+            throw new ConnectionException(
+                "Connection to server failed: " + ioe.getMessage());
+        }
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

http://dive4elements.wald.intevation.org