# HG changeset patch # User Ingo Weinzierl # Date 1309774642 0 # Node ID c4431f39926a200cb24c951900140efca9650c41 # Parent 97628364ab0b1dd0dc384d9b0d7ebd19e248ef16 New method to call a service with a ResponseHandler. http-client/trunk@2279 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 97628364ab0b -r c4431f39926a ChangeLog --- a/ChangeLog Tue Jun 28 07:59:28 2011 +0000 +++ b/ChangeLog Mon Jul 04 10:17:22 2011 +0000 @@ -1,3 +1,10 @@ +2011-07-04 Ingo Weinzierl + + * src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java, + src/main/java/de/intevation/artifacts/httpclient/http/HttpClient.java: + Added a method to call a service with a ResponseHandler. This allows us + to access the InputStream directly. + 2011-06-28 Ingo Weinzierl Tagged RELEASE 0.4 diff -r 97628364ab0b -r c4431f39926a src/main/java/de/intevation/artifacts/httpclient/http/HttpClient.java --- a/src/main/java/de/intevation/artifacts/httpclient/http/HttpClient.java Tue Jun 28 07:59:28 2011 +0000 +++ b/src/main/java/de/intevation/artifacts/httpclient/http/HttpClient.java Mon Jul 04 10:17:22 2011 +0000 @@ -59,6 +59,13 @@ Document callService(String url, String service, Document input) throws ConnectionException; + Object callService( + String url, + String service, + Document input, + ResponseHandler handler) + throws ConnectionException; + /******************************* * Collections API diff -r 97628364ab0b -r c4431f39926a src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java --- a/src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java Tue Jun 28 07:59:28 2011 +0000 +++ b/src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java Mon Jul 04 10:17:22 2011 +0000 @@ -475,23 +475,33 @@ public Document callService(String url, String service, Document input) throws ConnectionException { - if (logger.isDebugEnabled()) { - logger.debug("Start service call to '" + service + "'"); - } - DocumentResponseHandler handler = new DocumentResponseHandler(); - try { - String serverUrl = url + PATH_SERVICE + "/" + service; - return (Document) handler.handle(doPost(serverUrl, input)); - } - catch (IOException ioe) { - throw new ConnectionException( - "Connection to server failed: " + ioe.getMessage()); - } + return (Document) callService(url, service, input, handler); } + public Object callService( + String url, + String service, + Document input, + ResponseHandler handler) + throws ConnectionException { + if (logger.isDebugEnabled()) { + logger.debug("Start service call to '" + service + "'"); + } + + try { + String serverUrl = url + PATH_SERVICE + "/" + service; + return handler.handle(doPost(serverUrl, input)); + } + catch (IOException ioe) { + throw new ConnectionException( + "Connection to server failed: " + ioe.getMessage()); + } + } + + /******************************* * Users API *******************************/