use of org.expath.httpclient.HttpClientException in project exist by eXist-db.
the class EXistResult method add.
@Override
public void add(final Reader reader, final Charset charset) throws HttpClientException {
// START TEMP
// TODO(AR) - replace with a deferred StringReader when eXist has this soon.
final StringBuilder builder = new StringBuilder();
try {
final char[] cbuf = new char[4096];
int read = -1;
while ((read = reader.read(cbuf)) > -1) {
builder.append(cbuf, 0, read);
}
} catch (final IOException ioe) {
throw new HttpClientException("Unable to add string value to result: " + ioe.getMessage(), ioe);
} finally {
try {
reader.close();
} catch (final IOException ioe) {
logger.warn(ioe.getMessage(), ioe);
}
}
// END TEMP
result.add(new StringValue(builder.toString()));
}
use of org.expath.httpclient.HttpClientException in project exist by eXist-db.
the class EXistResult method add.
@Override
public void add(final Source src) throws HttpClientException {
try {
final NodeValue nodeValue = ModuleUtils.sourceToXML(context, src);
result.add(nodeValue);
} catch (final SAXException | IOException saxe) {
throw new HttpClientException("Unable to add Source to result:" + saxe.getMessage(), saxe);
}
}
Aggregations