protected WikiDocument getRenderedDocument(WikiContext context, String pagedata) throws IOException {
String pageid = context.getRealPage().getName() + VERSION_DELIMITER + context.getRealPage().getVersion();
Element element = m_documentCache.get(pageid);
if (element != null) {
WikiDocument doc = (WikiDocument) element.getObjectValue();
//
// This check is needed in case the different filters have actually changed the page data.
// FIXME: Figure out a faster method
if (pagedata.equals(doc.getPageData())) {
if (log.isDebugEnabled()) log.debug("Using cached HTML for page " + pageid);
return doc;
}
} else {
if (log.isDebugEnabled()) log.debug("Re-rendering and storing " + pageid);
}
//
// Refresh the data content
//
try
{
MarkupParser parser = getParser( context, pagedata );
WikiDocument doc = parser.parse();
doc.setPageData( pagedata );
m_documentCache.put( new Element(pageid, doc ));
return doc;
}
catch( IOException ex )
{