queryOptions.setDataAccessId("1");
queryOptions.setOutputType("json");
log.info("Doing query");
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
PrintStream printstream = new PrintStream(outputStream);
engine.doQuery(printstream, cdaSettings, queryOptions);
byte[] doc = outputStream.toByteArray();
return Response.ok(doc, MediaType.APPLICATION_JSON).header(
"content-length",doc.length).build();