Mercurial > dive4elements > http-client
changeset 12:5b62267a1c3c
The HttpClient got a new method that returns the InputStream of a Collection's OUT operation.
http-client/trunk@1857 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 09 May 2011 09:28:11 +0000 |
parents | ea8b7e244e61 |
children | 0359c4f3b4a1 |
files | ChangeLog src/main/java/de/intevation/artifacts/httpclient/http/HttpClient.java src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java |
diffstat | 3 files changed, 44 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Apr 14 07:51:51 2011 +0000 +++ b/ChangeLog Mon May 09 09:28:11 2011 +0000 @@ -1,3 +1,10 @@ +2011-05-09 Ingo Weinzierl <ingo@intevation.de> + + * src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java, + src/main/java/de/intevation/artifacts/httpclient/http/HttpClient.java: + Added a new method that returns the InputStream of a Collection's OUT + operation. + 2011-04-14 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java:
--- a/src/main/java/de/intevation/artifacts/httpclient/http/HttpClient.java Thu Apr 14 07:51:51 2011 +0000 +++ b/src/main/java/de/intevation/artifacts/httpclient/http/HttpClient.java Mon May 09 09:28:11 2011 +0000 @@ -7,6 +7,7 @@ */ package de.intevation.artifacts.httpclient.http; +import java.io.InputStream; import java.io.OutputStream; import org.w3c.dom.Document; @@ -82,6 +83,12 @@ OutputStream out) throws ConnectionException; + InputStream collectionOut( + Document doc, + String uuid, + String type) + throws ConnectionException; + /******************************* * Users API
--- a/src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java Thu Apr 14 07:51:51 2011 +0000 +++ b/src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java Mon May 09 09:28:11 2011 +0000 @@ -395,12 +395,8 @@ OutputStream out) throws ConnectionException { - String url = serverUrl + PATH_OUT_COLLECTION + "/" + uuid + "/" + type; - - ResponseHandler handler = new StreamResponseHandler(); - try { - InputStream stream = (InputStream) handler.handle(doPost(url, doc)); + InputStream stream = collectionOut(doc, uuid, type); byte[] b = new byte[4096]; int i = -1; @@ -414,6 +410,35 @@ } + /** + * This method triggers the out() operation of a Collection. The result of + * this operation is returned as an InputStream. + * + * @param doc The request document for the out() operation. + * @param uuid The identifier of the Collection. + * @param type The name of the output type. + * + * @return an InputStream. + */ + public InputStream collectionOut( + Document doc, + String uuid, + String type) + throws ConnectionException + { + String url = serverUrl + PATH_OUT_COLLECTION + "/" + uuid + "/" + type; + + ResponseHandler handler = new StreamResponseHandler(); + + try { + return (InputStream) handler.handle(doPost(url, doc)); + } + catch (IOException ioe) { + throw new ConnectionException(ioe.getMessage(), ioe); + } + } + + /******************************* * Service API *******************************/