Mercurial > dive4elements > http-client
comparison src/main/java/org/dive4elements/artifacts/httpclient/http/response/DocumentResponseHandler.java @ 116:c92b50c9c99a
Slightly improved error handling if response entity could not be parsed.
author | gernotbelger |
---|---|
date | Wed, 13 Jun 2018 15:37:12 +0200 |
parents | 133281653904 |
children |
comparison
equal
deleted
inserted
replaced
115:6e694ec61246 | 116:c92b50c9c99a |
---|---|
7 */ | 7 */ |
8 package org.dive4elements.artifacts.httpclient.http.response; | 8 package org.dive4elements.artifacts.httpclient.http.response; |
9 | 9 |
10 import java.io.IOException; | 10 import java.io.IOException; |
11 | 11 |
12 import org.dive4elements.artifacts.httpclient.utils.XMLUtils; | |
12 import org.restlet.Response; | 13 import org.restlet.Response; |
13 import org.restlet.representation.Representation; | 14 import org.restlet.representation.Representation; |
14 | |
15 import org.dive4elements.artifacts.httpclient.utils.XMLUtils; | |
16 | |
17 | 15 |
18 /** | 16 /** |
19 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 17 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
20 */ | 18 */ |
21 public class DocumentResponseHandler implements ResponseHandler { | 19 public class DocumentResponseHandler implements ResponseHandler { |
22 | 20 |
23 public DocumentResponseHandler() { | |
24 } | |
25 | |
26 @Override | 21 @Override |
27 public Object handle(Response response) throws IOException { | 22 public Object handle(final Response response) throws IOException { |
28 Representation output = response.getEntity(); | 23 final Representation output = response.getEntity(); |
29 return XMLUtils.readDocument(output.getStream()); | 24 // FIXME: stream not closed? |
25 return XMLUtils.readDocument(output.getStream()); | |
30 } | 26 } |
31 } | 27 } |
32 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: |