{
// 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);
String charset = pageContentType.getParameter(InternalConstants.CHARSET_CONTENT_TYPE_PARAMETER);
ContentType contentType = new ContentType(InternalConstants.JSON_MIME_TYPE);
contentType.setParameter(InternalConstants.CHARSET_CONTENT_TYPE_PARAMETER, charset);
MarkupWriter writer = _factory.newMarkupWriter(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();
}