StyledDOMThemeExtractor extractor =
factory.createExtractor(configuration, extractorContext);
StyleSheet styleSheet = extractor.extract(document);
StringWriter cssStringWriter = new StringWriter();
StyleSheetRenderer renderer = getStyleSheetRenderer();
MarinerPageContext marinerPageContext = getMarinerPageContext();
// todo better detect empty style sheet here and avoid rendering,
// and also remove dubious check for empty in renderStyleSheet?
MarinerRequestContext requestContext =
marinerPageContext.getRequestContext();
com.volantis.mcs.css.renderer.RendererContext runtimeCSSRendererContext =
new RuntimeRendererContext(cssStringWriter,
renderer, this,
getProtocolConfiguration().getCssVersion());
renderer.renderStyleSheet(styleSheet,
runtimeCSSRendererContext);
final String css = cssStringWriter.getBuffer().toString();
if (logger.isDebugEnabled()) {
logger.debug("Generated CSS is");
logger.debug("====");