Mercurial > dive4elements > http-client
diff src/main/java/de/intevation/artifacts/httpclient/http/HttpClientImpl.java @ 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 | 5cb8513b9e78 |
line wrap: on
line diff
--- 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 *******************************/