ComponentResources pageResources = page.getRootComponent().getComponentResources();
String contentTypeString = _metaDataLocator.findMeta(
TapestryConstants.RESPONSE_CONTENT_TYPE,
pageResources);
ContentType contentType = new ContentType(contentTypeString);
// Make sure thre's always a charset specified.
String encoding = contentType.getParameter(CHARSET);
if (encoding == null)
{
encoding = _metaDataLocator
.findMeta(TapestryConstants.RESPONSE_ENCODING, pageResources);
contentType.setParameter(CHARSET, encoding);
}
// Eventually we'll have to do work to figure out the correct markup type, content type,
// whatever. Right now its defaulting to plain HTML.
MarkupWriter writer = _markupWriterFactory.newMarkupWriter();
_markupRenderer.renderPageMarkup(page, writer);
PrintWriter pw = response.getPrintWriter(contentType.toString());
writer.toMarkup(pw);
pw.flush();
}