final Source source = new DBSource(broker, (BinaryDocument) resource, true);
final XQuery xquery = broker.getXQueryService();
final XQueryPool pool = xquery.getXQueryPool();
XQueryContext context;
CompiledXQuery compiled = pool.borrowCompiledXQuery(broker, source);
if (compiled == null) {
// special header to indicate that the query is not returned from
// cache
response.setHeader("X-XQuery-Cached", "false");
context = xquery.newContext(AccessContext.REST);