本文整理汇总了Java中freemarker.template.Version类的典型用法代码示例。如果您正苦于以下问题:Java Version类的具体用法?Java Version怎么用?Java Version使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Version类属于freemarker.template包,在下文中一共展示了Version类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getFreemarkerConfiguration
import freemarker.template.Version; //导入依赖的package包/类
@Override
protected Configuration getFreemarkerConfiguration(RepoCtx ctx)
{
if (useRemoteCallbacks)
{
// as per 3.0, 3.1
return super.getFreemarkerConfiguration(ctx);
}
else
{
Configuration cfg = new Configuration();
cfg.setObjectWrapper(new DefaultObjectWrapper());
cfg.setTemplateLoader(new ClassPathRepoTemplateLoader(nodeService, contentService, defaultEncoding));
// TODO review i18n
cfg.setLocalizedLookup(false);
cfg.setIncompatibleImprovements(new Version(2, 3, 20));
cfg.setNewBuiltinClassResolver(TemplateClassResolver.SAFER_RESOLVER);
return cfg;
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:LocalFeedTaskProcessor.java
示例2: buildFreemarkerHelper
import freemarker.template.Version; //导入依赖的package包/类
private FreemarkerHelper buildFreemarkerHelper(File templateBaseDir) {
Configuration configuration = new Configuration(new Version(2, 3, 0));
try {
TemplateLoader templateLoader = new FileTemplateLoader(templateBaseDir);
configuration.setTemplateLoader(templateLoader);
} catch (IOException e) {
throw new GeneratorException("构建模板助手出错:" + e.getMessage());
}
configuration.setNumberFormat("###############");
configuration.setBooleanFormat("true,false");
configuration.setDefaultEncoding("UTF-8");
// 自动导入公共文件,用于支持灵活变量
if (autoIncludeFile.exists()) {
List<String> autoIncludeList = new ArrayList<>();
autoIncludeList.add(FREEMARKER_AUTO_INCLUDE_SUFFIX);
configuration.setAutoIncludes(autoIncludeList);
}
return new FreemarkerHelper(configuration);
}
开发者ID:sgota,项目名称:tkcg,代码行数:21,代码来源:Generator.java
示例3: SchemaMaker
import freemarker.template.Version; //导入依赖的package包/类
/**
* @param onTable
*/
public SchemaMaker(String tenant, String module, TenantOperation mode, String previousVersion, String rmbVersion){
if(SchemaMaker.cfg == null){
//do this ONLY ONCE
SchemaMaker.cfg = new Configuration(new Version(2, 3, 26));
// Where do we load the templates from:
cfg.setClassForTemplateLoading(SchemaMaker.class, "/templates/db_scripts");
cfg.setDefaultEncoding("UTF-8");
cfg.setLocale(Locale.US);
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
}
this.tenant = tenant;
this.module = module;
this.mode = mode;
this.previousVersion = previousVersion;
this.rmbVersion = rmbVersion;
}
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:20,代码来源:SchemaMaker.java
示例4: EmailTemplate
import freemarker.template.Version; //导入依赖的package包/类
public EmailTemplate() {
ftlCfg = new Configuration(new Version(FREEMARKER_VERSION));
try {
// Check if templates are located from disk or if we are loading default ones.
String templatesDir = System.getenv(EmailPlugin.HAWKULAR_ALERTS_TEMPLATES);
templatesDir = templatesDir == null ? System.getProperty(EmailPlugin.HAWKULAR_ALERTS_TEMPLATES_PROPERY)
: templatesDir;
boolean templatesFromDir = false;
if (templatesDir != null) {
File fileDir = new File(templatesDir);
if (fileDir.exists()) {
ftlCfg.setDirectoryForTemplateLoading(fileDir);
templatesFromDir = true;
}
}
if (!templatesFromDir) {
ftlCfg.setClassForTemplateLoading(this.getClass(), "/");
}
ftlTemplatePlain = ftlCfg.getTemplate(DEFAULT_TEMPLATE_PLAIN, DEFAULT_LOCALE);
ftlTemplateHtml = ftlCfg.getTemplate(DEFAULT_TEMPLATE_HTML, DEFAULT_LOCALE);
} catch (IOException e) {
log.debug(e.getMessage(), e);
throw new RuntimeException("Cannot initialize templates on email plugin: " + e.getMessage());
}
}
开发者ID:hawkular,项目名称:hawkular-alerts,代码行数:26,代码来源:EmailTemplate.java
示例5: save
import freemarker.template.Version; //导入依赖的package包/类
public void save() throws Exception {
genTime = new Date().getTime();
deploymentXmlFile.getParentFile().mkdirs();
Configuration cfg = new Configuration(new Version(2, 3, 22));
cfg.setClassLoaderForTemplateLoading(this.getClass().getClassLoader(), "templates");
cfg.setDefaultEncoding("UTF-8");
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
Template template = cfg.getTemplate("parent_last.ftl");
FileOutputStream outputStream = new FileOutputStream(deploymentXmlFile);
Writer out = new OutputStreamWriter(outputStream);
template.process(this, out);
outputStream.flush();
outputStream.close();
}
开发者ID:craigstjean,项目名称:WebSphere-Deployment-Xml-Tool,代码行数:18,代码来源:DeploymentXmlWriter.java
示例6: getTemplate
import freemarker.template.Version; //导入依赖的package包/类
public static Template getTemplate(String name) {
Template template = null;
try {
Version version = new Version("2.3.0");
Configuration cfg = new Configuration(version);
// 读取ftl模板
cfg.setClassForTemplateLoading(FreemarkerConfiguration.class, "/ftl");
cfg.setClassicCompatible(true);
cfg.setDefaultEncoding("UTF-8");
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.HTML_DEBUG_HANDLER);
cfg.setObjectWrapper(new SaicObjectWrapper(cfg.getIncompatibleImprovements()));
template = cfg.getTemplate(name);
} catch (IOException e) {
e.printStackTrace();
}
return template;
}
开发者ID:tojaoomy,项目名称:private-freemarker,代码行数:18,代码来源:FreemarkerConfiguration.java
示例7: AbstractPrintGeneratingTest
import freemarker.template.Version; //导入依赖的package包/类
AbstractPrintGeneratingTest() {
targetDirectory.mkdirs();
try {
freeMarkerConfiguration = new Configuration();
freeMarkerConfiguration.setTemplateLoader(new ClassTemplateLoader(Class.class, "/"));
//freeMarkerConfiguration.setDirectoryForTemplateLoading(new File(templateDirectory).getAbsoluteFile());
freeMarkerConfiguration.setObjectWrapper(new DefaultObjectWrapper());
freeMarkerConfiguration.setDefaultEncoding("UTF-8");
freeMarkerConfiguration.setTemplateExceptionHandler(HTML_DEBUG_HANDLER);
freeMarkerConfiguration.setIncompatibleImprovements(new Version(2, 3, 20));
printsRendererService.setFreeMarkerConfiguration(freeMarkerConfiguration);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:tunguski,项目名称:matsuo-core,代码行数:18,代码来源:AbstractPrintGeneratingTest.java
示例8: freemarkerConfig
import freemarker.template.Version; //导入依赖的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
示例9: applyTemplate
import freemarker.template.Version; //导入依赖的package包/类
public static boolean applyTemplate(File sourceTemplate, File destinationFile, Map<?, ?> data) throws IOException, TemplateException{
boolean success = true;
// Process the template file using the data in the "data" Map
final Configuration cfg = new Configuration( new Version("2.3.23"));
cfg.setDirectoryForTemplateLoading(sourceTemplate.getParentFile());
// Load template from source folder
final Template template = cfg.getTemplate(sourceTemplate.getName());
// Console output
BufferedWriter fw = null;
try {
fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(destinationFile), Charset.forName("UTF-8")));
template.process(data, fw);
}finally {
if (fw != null) {
fw.close();
}
}
return success;
}
开发者ID:openforis,项目名称:collect-earth,代码行数:26,代码来源:FreemarkerTemplateUtils.java
示例10: getFreemarkerConfiguration
import freemarker.template.Version; //导入依赖的package包/类
protected Configuration getFreemarkerConfiguration(RepoCtx ctx)
{
Configuration cfg = new Configuration();
cfg.setObjectWrapper(new DefaultObjectWrapper());
// custom template loader
cfg.setTemplateLoader(new TemplateWebScriptLoader(ctx.getRepoEndPoint(), ctx.getTicket()));
// TODO review i18n
cfg.setLocalizedLookup(false);
cfg.setIncompatibleImprovements(new Version(2, 3, 20));
cfg.setNewBuiltinClassResolver(TemplateClassResolver.SAFER_RESOLVER);
return cfg;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:16,代码来源:FeedTaskProcessor.java
示例11: getStringConfig
import freemarker.template.Version; //导入依赖的package包/类
/**
* FreeMarker configuration for loading the specified template directly from a String
*
* @param path Pseudo Path to the template
* @param template Template content
*
* @return FreeMarker configuration
*/
protected Configuration getStringConfig(String path, String template)
{
Configuration config = new Configuration();
// setup template cache
config.setCacheStorage(new MruCacheStorage(2, 0));
// use our custom loader to load a template directly from a String
StringTemplateLoader stringTemplateLoader = new StringTemplateLoader();
stringTemplateLoader.putTemplate(path, template);
config.setTemplateLoader(stringTemplateLoader);
// use our custom object wrapper that can deal with QNameMap objects directly
config.setObjectWrapper(qnameObjectWrapper);
// rethrow any exception so we can deal with them
config.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
// set default template encoding
if (defaultEncoding != null)
{
config.setDefaultEncoding(defaultEncoding);
}
config.setIncompatibleImprovements(new Version(2, 3, 20));
config.setNewBuiltinClassResolver(TemplateClassResolver.SAFER_RESOLVER);
return config;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:37,代码来源:FreeMarkerProcessor.java
示例12: handle
import freemarker.template.Version; //导入依赖的package包/类
@Override
public HttpResponse handle(HttpRequest request, MiddlewareChain chain) {
ContentNegotiable negotiable = ContentNegotiable.class.cast(MixinUtils.mixin(request, ContentNegotiable.class));
HttpResponse response = castToHttpResponse(chain.next(request));
if (TemplatedHttpResponse.class.isInstance(response)) {
TemplatedHttpResponse tres = TemplatedHttpResponse.class.cast(response);
ResourceBundle bundle = config.getMessageResource().getBundle(negotiable.getLocale());
tres.getContext().put("t", new ResourceBundleModel(bundle,
new BeansWrapperBuilder(new Version(2,3,23)).build()));
}
return response;
}
开发者ID:kawasima,项目名称:bouncr,代码行数:13,代码来源:I18nMiddleware.java
示例13: create
import freemarker.template.Version; //导入依赖的package包/类
public static ScipioBasicBeansWrapperImpl create(Version incompatibleImprovements, Boolean simpleMapWrapper) {
ScipioBasicBeansWrapperImpl wrapper = new ScipioBasicBeansWrapperImpl(incompatibleImprovements, systemWrapperFactories);
if (simpleMapWrapper != null) {
wrapper.setSimpleMapWrapper(simpleMapWrapper);
}
return wrapper;
}
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:8,代码来源:ScipioFtlWrappers.java
示例14: getTemplateEngine
import freemarker.template.Version; //导入依赖的package包/类
@Bean
public TemplateEngine getTemplateEngine() {
Version version = new Version(2, 3, 25);
freemarker.template.Configuration cfg = new freemarker.template.Configuration(version);
cfg.setClassForTemplateLoading(RallyServiceApp.class, "/");
cfg.setIncompatibleImprovements(version);
cfg.setDefaultEncoding(Charsets.UTF_8.toString());
cfg.setLocale(Locale.US);
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
return new FreemarkerTemplateEngine(cfg);
}
开发者ID:reportportal,项目名称:service-rally,代码行数:15,代码来源:RallyServiceApp.java
示例15: FacetManager
import freemarker.template.Version; //导入依赖的package包/类
/**
* indicate the table name to query + facet on
* @param onTable
*/
public FacetManager(String onTable){
this.table = onTable;
if(FacetManager.cfg == null){
//do this ONLY ONCE
FacetManager.cfg = new Configuration(new Version(2, 3, 26));
// Where do we load the templates from:
cfg.setClassForTemplateLoading(FacetManager.class, "/templates/facets");
cfg.setDefaultEncoding("UTF-8");
cfg.setLocale(Locale.US);
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
}
}
开发者ID:folio-org,项目名称:raml-module-builder,代码行数:17,代码来源:FacetManager.java
示例16: createConfig
import freemarker.template.Version; //导入依赖的package包/类
private Configuration createConfig(){
Configuration config = new Configuration(new Version(2, 3, 23));
config.setDefaultEncoding("UTF-8");
config.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
config.setCacheStorage(NullCacheStorage.INSTANCE);
return config;
}
开发者ID:automate-website,项目名称:jwebrobot,代码行数:8,代码来源:FreemarkerExpressionEvaluator.java
示例17: getFreemarkerConfiguration
import freemarker.template.Version; //导入依赖的package包/类
private Configuration getFreemarkerConfiguration() {
if (mFreemarkerConfiguration == null) {
mFreemarkerConfiguration = new Configuration(new Version(2, 3, 22));
mFreemarkerConfiguration.setClassForTemplateLoading(getClass(), "");
}
return mFreemarkerConfiguration;
}
开发者ID:FabianTerhorst,项目名称:Iron,代码行数:8,代码来源:StoreProcessor.java
示例18: getFreemarkerConfiguration
import freemarker.template.Version; //导入依赖的package包/类
private Configuration getFreemarkerConfiguration() {
if (mFreemarkerConfiguration == null) {
mFreemarkerConfiguration = new Configuration(new Version(2, 3, 26));
mFreemarkerConfiguration.setClassForTemplateLoading(getClass(), "");
}
return mFreemarkerConfiguration;
}
开发者ID:BoD,项目名称:android-prefs,代码行数:8,代码来源:PrefsProcessor.java
示例19: Templates
import freemarker.template.Version; //导入依赖的package包/类
public Templates(String dirPath) throws IOException {
this.dirPath = dirPath;
cfg = new Configuration();
cfg.setLocalizedLookup(false);
cfg.setDirectoryForTemplateLoading(new File(this.dirPath));
cfg.setObjectWrapper(new DefaultObjectWrapper());
cfg.setDefaultEncoding("UTF-8");
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.HTML_DEBUG_HANDLER);
cfg.setIncompatibleImprovements(new Version(2, 3, 20));
}
开发者ID:edolganov,项目名称:live-chat-engine,代码行数:12,代码来源:Templates.java
示例20: getConfigurationInstance
import freemarker.template.Version; //导入依赖的package包/类
private static Configuration getConfigurationInstance(String destDir) throws IOException {
if (cfg == null) {
try {
cfg = new Configuration();
} catch (Exception e) {
e.printStackTrace();
}
cfg.setDirectoryForTemplateLoading(new File(destDir));
cfg.setObjectWrapper(new DefaultObjectWrapper());
cfg.setDefaultEncoding("UTF-8");
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.HTML_DEBUG_HANDLER);
cfg.setIncompatibleImprovements(new Version(2, 3, 20));
}
return cfg;
}
开发者ID:arsadeghi,项目名称:ACME-Generator,代码行数:16,代码来源:Covert2AcmeGenerator.java
注:本文中的freemarker.template.Version类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论