comparison src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java @ 26:c4431f39926a

New method to call a service with a ResponseHandler. http-client/trunk@2279 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 04 Jul 2011 10:17:22 +0000
parents 79a5a2455d6d
children 875a5c409560
comparison
equal deleted inserted replaced
24:97628364ab0b 26:c4431f39926a
473 *******************************/ 473 *******************************/
474 474
475 public Document callService(String url, String service, Document input) 475 public Document callService(String url, String service, Document input)
476 throws ConnectionException 476 throws ConnectionException
477 { 477 {
478 if (logger.isDebugEnabled()) {
479 logger.debug("Start service call to '" + service + "'");
480 }
481
482 DocumentResponseHandler handler = new DocumentResponseHandler(); 478 DocumentResponseHandler handler = new DocumentResponseHandler();
483 479
484 try { 480 return (Document) callService(url, service, input, handler);
485 String serverUrl = url + PATH_SERVICE + "/" + service;
486 return (Document) handler.handle(doPost(serverUrl, input));
487 }
488 catch (IOException ioe) {
489 throw new ConnectionException(
490 "Connection to server failed: " + ioe.getMessage());
491 }
492 } 481 }
482
483
484 public Object callService(
485 String url,
486 String service,
487 Document input,
488 ResponseHandler handler)
489 throws ConnectionException {
490 if (logger.isDebugEnabled()) {
491 logger.debug("Start service call to '" + service + "'");
492 }
493
494 try {
495 String serverUrl = url + PATH_SERVICE + "/" + service;
496 return handler.handle(doPost(serverUrl, input));
497 }
498 catch (IOException ioe) {
499 throw new ConnectionException(
500 "Connection to server failed: " + ioe.getMessage());
501 }
502 }
493 503
494 504
495 /******************************* 505 /*******************************
496 * Users API 506 * Users API
497 *******************************/ 507 *******************************/

http://dive4elements.wald.intevation.org