當前位置: 首頁>>代碼示例>>Java>>正文


Java FreeMarkerConfigurer.setTemplateLoaderPath方法代碼示例

本文整理匯總了Java中org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer.setTemplateLoaderPath方法的典型用法代碼示例。如果您正苦於以下問題:Java FreeMarkerConfigurer.setTemplateLoaderPath方法的具體用法?Java FreeMarkerConfigurer.setTemplateLoaderPath怎麽用?Java FreeMarkerConfigurer.setTemplateLoaderPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer的用法示例。


在下文中一共展示了FreeMarkerConfigurer.setTemplateLoaderPath方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getFreemarkerConfig

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer; //導入方法依賴的package包/類
@Bean
public FreeMarkerConfigurer getFreemarkerConfig() throws IOException, TemplateException {
	final FreeMarkerConfigurationFactory factory = new FreeMarkerConfigurationFactory();
	factory.setTemplateLoaderPath("/WEB-INF/views/");
	factory.setDefaultEncoding("UTF-8");
	final Properties properties = new Properties();
	properties.put("auto_import", "spring.ftl as spring");
	properties.put("template_exception_handler", "rethrow");
	factory.setFreemarkerSettings(properties);
	final Map<String, Object> sharedVariables = new HashMap<String, Object>();
	sharedVariables.put("include", this.freemarkerIncludeDirective);
	factory.setFreemarkerVariables(sharedVariables);
	factory.setPreferFileSystemAccess(false);

	final FreeMarkerConfigurer result = new FreeMarkerConfigurer();
	// FIXME factory not working
	// result.setConfiguration(factory.createConfiguration());
	result.setTemplateLoaderPath("/WEB-INF/views/");
	result.setFreemarkerVariables(sharedVariables);
	result.setFreemarkerSettings(properties);

	return result;
}
 
開發者ID:TeeFun,項目名稱:TeeFun,代碼行數:24,代碼來源:MvcConfig.java

示例2: freemarkerConfig

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer; //導入方法依賴的package包/類
/**
 * FreeMarker (ftl) configuration
 */
@Bean
public FreeMarkerConfigurer freemarkerConfig() throws IOException, TemplateException {
	final FreeMarkerConfigurer result = new FreeMarkerConfigurer();

	// template path
	result.setTemplateLoaderPath("/WEB-INF/ftl/");
	result.setDefaultEncoding("UTF-8");

	// static access
	final Version version = freemarker.template.Configuration.getVersion();
	final BeansWrapper wrapper = new BeansWrapper(version);
	final TemplateHashModel statics = wrapper.getStaticModels();
	final Map<String, Object> shared = new HashMap<>();
	for (final Class<?> clazz : ElFunctions.staticClasses) {
		shared.put(clazz.getSimpleName(), statics.get(clazz.getName()));
	}
	result.setFreemarkerVariables(shared);

	return result;
}
 
開發者ID:Katharsas,項目名稱:GMM,代碼行數:24,代碼來源:ApplicationConfiguration.java

示例3: freeMarkerConfigurer

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer; //導入方法依賴的package包/類
@Bean
public FreeMarkerConfigurer freeMarkerConfigurer() {
    final FreeMarkerConfigurer conf = new FreeMarkerConfigurer();
    conf.setTemplateLoaderPath("/WEB-INF/views/");
    conf.setDefaultEncoding("UTF-8");
    return conf;
}
 
開發者ID:music-for-all,項目名稱:music-for-all-application,代碼行數:8,代碼來源:WebAppConfig.java

示例4: configureFreemarker

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer; //導入方法依賴的package包/類
@Bean
public FreeMarkerConfigurer configureFreemarker() {
    FreeMarkerConfigurer freeMarkerConfigurer = new FreeMarkerConfigurer();
    Properties settings = new Properties();

    settings.setProperty(freemarker.template.Configuration.TEMPLATE_EXCEPTION_HANDLER_KEY, "rethrow");
    freeMarkerConfigurer.setFreemarkerSettings(settings);
    freeMarkerConfigurer.setTemplateLoaderPath(FreeMarkerProperties.DEFAULT_TEMPLATE_LOADER_PATH);

    return freeMarkerConfigurer;
}
 
開發者ID:scionaltera,項目名稱:emergentmud,代碼行數:12,代碼來源:HttpConfiguration.java

示例5: freemarkerConfigurer

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer; //導入方法依賴的package包/類
@Bean
public FreeMarkerConfigurer freemarkerConfigurer() throws IOException {
    FreeMarkerConfigurer result = new FreeMarkerConfigurer();
    if (nixmashModeEnabled)
        result.setTemplateLoaderPath("classpath:/nixmarker/");
    else
        result.setTemplateLoaderPath("classpath:/freemarker/");
    return result;
}
 
開發者ID:mintster,項目名稱:nixmash-blog,代碼行數:10,代碼來源:MailConfig.java

示例6: freemarkerConfig

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer; //導入方法依賴的package包/類
@Bean
public FreeMarkerConfigurer freemarkerConfig() {
    FreeMarkerConfigurer freeMarkerConfigurer = new FreeMarkerConfigurer();
    freeMarkerConfigurer.setTemplateLoaderPath("/freemarker/view");
    freeMarkerConfigurer.setDefaultEncoding("UTF-8");
    freeMarkerConfigurer.setPreferFileSystemAccess(false);
    return freeMarkerConfigurer;
}
 
開發者ID:opensingular,項目名稱:singular-server,代碼行數:9,代碼來源:ServerStudioWebMVCConfig.java

示例7: freeMarkerConfigurer

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer; //導入方法依賴的package包/類
@Bean
public FreeMarkerConfigurer freeMarkerConfigurer() {
    final FreeMarkerConfigurer conf = new FreeMarkerConfigurer();
    conf.setTemplateLoaderPath("/WEB-INF/views/mails/");
    conf.setDefaultEncoding("UTF-8");
    return conf;
}
 
開發者ID:music-for-all,項目名稱:music-for-all-application,代碼行數:8,代碼來源:MailConfig.java

示例8: freeMarkerConfigurer

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer; //導入方法依賴的package包/類
@Bean
public FreeMarkerConfigurer freeMarkerConfigurer () {
  FreeMarkerConfigurer configurer = new FreeMarkerConfigurer ();
  configurer.setTemplateLoaderPath ("classpath:");
  configurer.setPreferFileSystemAccess (false);
  return configurer;
}
 
開發者ID:dfci-cccb,項目名稱:mev,代碼行數:8,代碼來源:ViewResolverConfiguration.java

示例9: freeMarkerConfigurer

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer; //導入方法依賴的package包/類
/**
 * Configure freemarker. All freemarker templates should be on the classpath in a package called 'freemarker'
 */
@Bean
public FreeMarkerConfigurer freeMarkerConfigurer()
{
	FreeMarkerConfigurer result = new FreeMarkerConfigurer()
	{
		@Override
		protected void postProcessConfiguration(Configuration config) throws IOException, TemplateException
		{
			config.setObjectWrapper(new MolgenisFreemarkerObjectWrapper(VERSION_2_3_23));
		}
	};
	result.setPreferFileSystemAccess(false);
	result.setTemplateLoaderPath("classpath:/templates/");
	result.setDefaultEncoding("UTF-8");
	Properties freemarkerSettings = new Properties();
	freemarkerSettings.setProperty(Configuration.LOCALIZED_LOOKUP_KEY, Boolean.FALSE.toString());
	result.setFreemarkerSettings(freemarkerSettings);
	Map<String, Object> freemarkerVariables = Maps.newHashMap();
	freemarkerVariables.put("limit", new LimitMethod());
	freemarkerVariables.put("hasPermission", new HasPermissionDirective(permissionService));
	freemarkerVariables.put("notHasPermission", new NotHasPermissionDirective(permissionService));
	addFreemarkerVariables(freemarkerVariables);

	result.setFreemarkerVariables(freemarkerVariables);

	return result;
}
 
開發者ID:molgenis,項目名稱:molgenis,代碼行數:31,代碼來源:MolgenisWebAppConfig.java

示例10: freeMarkerConfigurer

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer; //導入方法依賴的package包/類
@Bean
public FreeMarkerConfigurer freeMarkerConfigurer() {
	FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
	configurer.setTemplateLoaderPath("classpath:/templates/");
	configurer.setDefaultEncoding("UTF-8");
	return configurer;
}
 
開發者ID:Plixee,項目名稱:brainbox,代碼行數:8,代碼來源:WebConfig.java

示例11: freeMarkerConfigurer

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer; //導入方法依賴的package包/類
@Bean
FreeMarkerConfigurer freeMarkerConfigurer() {
    FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
    configurer.setTemplateLoaderPath("classpath:META-INF/freemarker");

    return configurer;
}
 
開發者ID:pivotalsoftware,項目名稱:github-cla-integration,代碼行數:8,代碼來源:WebConfiguration.java

示例12: getFreemarkerConfig

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer; //導入方法依賴的package包/類
@Bean(name = "freemarkerConfig")
public FreeMarkerConfigurer getFreemarkerConfig() {
    FreeMarkerConfigurer config = new FreeMarkerConfigurer();
   config.setTemplateLoaderPath("/WEB-INF/templates/");
    return config;
}
 
開發者ID:PacktPublishing,項目名稱:Spring-5.0-Cookbook,代碼行數:7,代碼來源:SpringContextConfig.java

示例13: freeMarkerConfigurer

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer; //導入方法依賴的package包/類
@Bean
public FreeMarkerConfigurer freeMarkerConfigurer() {
	FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
	configurer.setTemplateLoaderPath("/WEB-INF/");
	return configurer;
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:7,代碼來源:ViewResolutionIntegrationTests.java

示例14: providesFreeMarkerConfigurer

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer; //導入方法依賴的package包/類
@Bean
public FreeMarkerConfigurer providesFreeMarkerConfigurer() {
	FreeMarkerConfigurer fmc = new FreeMarkerConfigurer();
	fmc.setTemplateLoaderPath("/WEB-INF/views/freemarker/");
	return fmc;
}
 
開發者ID:anastasop,項目名稱:elementary,代碼行數:7,代碼來源:SpringMVCConfiguration.java

示例15: freeMarkerConfigurer

import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer; //導入方法依賴的package包/類
@Bean
public FreeMarkerConfigurer freeMarkerConfigurer() {
	FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
	configurer.setTemplateLoaderPath("/WEB-INF/templates/");
	return configurer;
}
 
開發者ID:hantsy,項目名稱:spring4-sandbox,代碼行數:7,代碼來源:WebConfig.java


注:本文中的org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer.setTemplateLoaderPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。