ContentType contentType = new ContentType(InternalConstants.JSON_MIME_TYPE, outputEncoding);
MarkupWriter writer = factory.newPartialMarkupWriter(pageContentType);
JSONObject reply = new JSONObject();
// ... and here, the pipeline eventually reaches the PRQ to let it render the root render command.
partialMarkupRenderer.renderMarkup(writer, reply);
PrintWriter pw = response.getPrintWriter(contentType.toString());
reply.print(pw, compactJSON);
pw.close();
} finally
{
environment.decloak();