diff 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
line wrap: on
line diff
--- 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
      *******************************/

http://dive4elements.wald.intevation.org