Java Code Examples for freemarker.template.Configuration#getObjectWrapper()

The following examples show how to use freemarker.template.Configuration#getObjectWrapper() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FreemarkerConfigurationBuilder.java    From ogham with Apache License 2.0 5 votes vote down vote up
private static BeansWrapper getBeansWrapper(Configuration configuration) {
	ObjectWrapper objectWrapper = configuration.getObjectWrapper();
	if (objectWrapper instanceof BeansWrapper) {
		return (BeansWrapper) objectWrapper;
	}
	return new BeansWrapperBuilder(configuration.getIncompatibleImprovements()).build();
}
 
Example 2
Source File: FreemarkerConfigurer.java    From ogham with Apache License 2.0 5 votes vote down vote up
private static BeansWrapper getBeansWrapper(Configuration configuration) {
	ObjectWrapper objectWrapper = configuration.getObjectWrapper();
	if (objectWrapper instanceof BeansWrapper) {
		return (BeansWrapper) objectWrapper;
	}
	return new BeansWrapperBuilder(configuration.getIncompatibleImprovements()).build();
}
 
Example 3
Source File: SiteContextResolvingFilter.java    From engine with GNU General Public License v3.0 5 votes vote down vote up
protected void renderError(HttpServletResponse response) {
    response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    try {
        Configuration configuration = freeMarkerConfigFactory.getObject().getConfiguration();
        Template template = configuration.getTemplate(errorTemplate);
        SimpleHash model = new SimpleHash(configuration.getObjectWrapper());
        configuration.setAllSharedVariables(model);
        template.process(model, response.getWriter());
    } catch (Exception e) {
        logger.error("Error rendering template for site resolving error", e);
    }
}