if (logger.isDebugEnabled()) {
logger.debug("log4j initialized");
}
// 2. init transformer service
TransformerService transformerService = new CachingTransformerService(new FileResourceResolver());
transformerService.setTransformerFactory(TransformerFactory.newInstance());
if (Boolean.valueOf(getInitParameter(PARAM_XSLT_CACHE)).booleanValue()) {
if (logger.isDebugEnabled()) {
logger.debug("initializing xslt cache");
}
// load default stylesheet
// todo: extract parameter names
String xsltPath = getServletContext().getInitParameter("chiba.web.xslt.path");
String xsltDefault = getServletContext().getInitParameter("chiba.web.xslt.default");
URI uri = new File(getServletContext().getRealPath(xsltPath)).toURI().resolve(new URI(xsltDefault));
transformerService.getTransformer(uri);
}
// store service in servlet context
// todo: contemplate about transformer service thread-safety
getServletContext().setAttribute(TransformerService.class.getName(), transformerService);