# HG changeset patch # User Ingo Weinzierl # Date 1304933291 0 # Node ID 5b62267a1c3c35a4c879a23f6da2f37d03ab6dc5 # Parent ea8b7e244e617ae0d7994bb9be7d9f0b38d46258 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 diff -r ea8b7e244e61 -r 5b62267a1c3c ChangeLog --- 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 + + * 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 * src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java: diff -r ea8b7e244e61 -r 5b62267a1c3c src/main/java/de/intevation/artifacts/httpclient/http/HttpClient.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 diff -r ea8b7e244e61 -r 5b62267a1c3c src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java --- 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 *******************************/