Mercurial > dive4elements > http-client
changeset 4:19b3ba7f2568
Added a method to the http client to list the existing users of the artifact database.
http-client/trunk@1412 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 07 Mar 2011 13:42:33 +0000 |
parents | 19a617578b88 |
children | 7917c21fad01 |
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, 44 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Mar 04 11:49:49 2011 +0000 +++ b/ChangeLog Mon Mar 07 13:42:33 2011 +0000 @@ -1,3 +1,9 @@ +2011-03-07 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 method to list the existing users of the artifact server. + 2011-03-04 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 Fri Mar 04 11:49:49 2011 +0000 +++ b/src/main/java/de/intevation/artifacts/httpclient/http/HttpClient.java Mon Mar 07 13:42:33 2011 +0000 @@ -28,12 +28,6 @@ Object create(Document createDocument, ArtifactCreator creator) throws ConnectionException; - Object createCollection( - Document createDocument, - String ownerId, - ResponseHandler handler) - throws ConnectionException; - Object describe( Artifact artifact, Document describeDocument, @@ -55,5 +49,22 @@ String target, OutputStream out) throws ConnectionException; + + + /******************************* + * Collections API + *******************************/ + Object createCollection( + Document createDocument, + String ownerId, + ResponseHandler handler) + throws ConnectionException; + + + /******************************* + * Users API + *******************************/ + Document listUsers() + 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 Mar 04 11:49:49 2011 +0000 +++ b/src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java Mon Mar 07 13:42:33 2011 +0000 @@ -42,6 +42,9 @@ private static final Logger logger = Logger.getLogger(HttpClient.class); + /** 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 path of the resource to create new artifact collections.*/ public static final String PATH_CREATE_COLLECTION = "/create-collection"; @@ -254,5 +257,23 @@ return response; } + + + /******************************* + * Users API + *******************************/ + public Document listUsers() + throws ConnectionException + { + ResponseHandler handler = new DocumentResponseHandler(); + String url = serverUrl + PATH_LIST_USERS; + + 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: