{
// This is a complex area as we are trying to keep public and private services properly
// seperated, and trying to keep stateless and stateful (i.e., perthread scope) services
// seperated. So we inform the stateful queue service what it needs to do here ...
ContentType pageContentType =
(ContentType) request.getAttribute(InternalConstants.CONTENT_TYPE_ATTRIBUTE_NAME);
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());
pw.print(reply);
pw.flush();
}