comparison src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java @ 34:875a5c409560 2.8

Implemented a createUser method for HttpClient. With the new method its possible to create new users via the HttpClient. http-client/trunk@4993 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Ricks <bjoern.ricks@intevation.de>
date Fri, 13 Jul 2012 13:31:34 +0000
parents c4431f39926a
children 874c25363dc9
comparison
equal deleted inserted replaced
33:0d5ec0f2e6b5 34:875a5c409560
52 52
53 /** The URL part of the resource to list the Collections owned by a specific 53 /** The URL part of the resource to list the Collections owned by a specific
54 * user.*/ 54 * user.*/
55 public static final String PATH_USER_COLLECTIONS = "/list-collections"; 55 public static final String PATH_USER_COLLECTIONS = "/list-collections";
56 56
57 /** The URL part og the resource to create a new user on the server.*/
58 public static final String PATH_CREATE_USER = "/create-user";
59
57 /** The URL part of the resource to call a specific service.*/ 60 /** The URL part of the resource to call a specific service.*/
58 public static final String PATH_SERVICE = "/service"; 61 public static final String PATH_SERVICE = "/service";
59 62
60 /** The URL path of the resource to create new artifact collections.*/ 63 /** The URL path of the resource to create new artifact collections.*/
61 public static final String PATH_CREATE_COLLECTION = "/create-collection"; 64 public static final String PATH_CREATE_COLLECTION = "/create-collection";
533 } 536 }
534 catch (IOException ioe) { 537 catch (IOException ioe) {
535 throw new ConnectionException(ioe.getMessage(), ioe); 538 throw new ConnectionException(ioe.getMessage(), ioe);
536 } 539 }
537 } 540 }
541
542 @Override
543 public Document createUser(Document doc)
544 throws ConnectionException {
545 ResponseHandler handler = new DocumentResponseHandler();
546
547 String url = this.serverUrl + PATH_CREATE_USER;
548
549 try {
550 return (Document) handler.handle(doPost(url, doc));
551 }
552 catch (IOException ioe) {
553 throw new ConnectionException(
554 "Connection to server failed: " + ioe.getMessage());
555 }
556 }
538 } 557 }
539 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: 558 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

http://dive4elements.wald.intevation.org