public void run() { QueryManagement queryMgr = getQueryManager(); try (ResultCursor<XQItemAccessor> cursor = queryMgr.executeQuery(params.query, params.params, params.props)) { int idx = 0; for (XQItemAccessor item: cursor) { if (idx > 0) { output.write(splitter); } String chunk = item.getItemAsString(null); logger.trace("postQuery; idx: {}; chunk: {}", idx, chunk); output.write(chunk); idx++; } } catch (Exception ex) { // XDMException, IOException. handle it somehow ? logger.error("postQuery.error", ex); throw new WebApplicationException(ex, Status.INTERNAL_SERVER_ERROR); } finally { try { output.close(); } catch (IOException ex) { // } } } }.start();
String uri = item.getAtomicValue(); item = getBoundItem(params, "doc"); String xml = item.getItemAsString(null);