mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 16:35:45 +01:00
use setServletContextForTemplateLoading instead of setDirectoryForTemplateLoading, see issue #38
This commit is contained in:
@@ -92,32 +92,10 @@ public class FreemarkerTemplateHandler implements TemplateHandler
|
|||||||
@Inject
|
@Inject
|
||||||
public FreemarkerTemplateHandler(ServletContext servletContext)
|
public FreemarkerTemplateHandler(ServletContext servletContext)
|
||||||
{
|
{
|
||||||
try
|
configuration = new Configuration();
|
||||||
{
|
configuration.setServletContextForTemplateLoading(servletContext,
|
||||||
configuration = new Configuration();
|
DIRECTORY_TEMPLATES);
|
||||||
|
configuration.setEncoding(Locale.ENGLISH, ENCODING);
|
||||||
String path = servletContext.getRealPath(DIRECTORY_TEMPLATES);
|
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
|
||||||
{
|
|
||||||
logger.debug("configure template handler for directory '{}'",
|
|
||||||
Util.nonNull(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (path == null)
|
|
||||||
{
|
|
||||||
throw new ConfigurationException(
|
|
||||||
"could not resolve template handler path");
|
|
||||||
}
|
|
||||||
|
|
||||||
configuration.setDirectoryForTemplateLoading(new File(path));
|
|
||||||
configuration.setEncoding(Locale.ENGLISH, ENCODING);
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
throw new ConfigurationException(
|
|
||||||
"could not create FreemarkerTemplateHandler", ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
//~--- methods --------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user