Mercurial > dive4elements > http-client
comparison src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java @ 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 |
comparison
equal
deleted
inserted
replaced
3:19a617578b88 | 4:19b3ba7f2568 |
---|---|
40 */ | 40 */ |
41 public class HttpClientImpl implements HttpClient { | 41 public class HttpClientImpl implements HttpClient { |
42 | 42 |
43 private static final Logger logger = Logger.getLogger(HttpClient.class); | 43 private static final Logger logger = Logger.getLogger(HttpClient.class); |
44 | 44 |
45 /** The URL part of the resource to list the existing users of the server.*/ | |
46 public static final String PATH_LIST_USERS = "/list-users"; | |
47 | |
45 /** The URL path of the resource to create new artifact collections.*/ | 48 /** The URL path of the resource to create new artifact collections.*/ |
46 public static final String PATH_CREATE_COLLECTION = "/create-collection"; | 49 public static final String PATH_CREATE_COLLECTION = "/create-collection"; |
47 | 50 |
48 private String serverUrl; | 51 private String serverUrl; |
49 | 52 |
252 throw new IOException(status.getDescription()); | 255 throw new IOException(status.getDescription()); |
253 } | 256 } |
254 | 257 |
255 return response; | 258 return response; |
256 } | 259 } |
260 | |
261 | |
262 /******************************* | |
263 * Users API | |
264 *******************************/ | |
265 public Document listUsers() | |
266 throws ConnectionException | |
267 { | |
268 ResponseHandler handler = new DocumentResponseHandler(); | |
269 String url = serverUrl + PATH_LIST_USERS; | |
270 | |
271 try { | |
272 return (Document) handler.handle(doGet(url)); | |
273 } | |
274 catch (IOException ioe) { | |
275 throw new ConnectionException(ioe.getMessage(), ioe); | |
276 } | |
277 } | |
257 } | 278 } |
258 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: | 279 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: |