本文整理汇总了Java中org.apache.velocity.tools.ToolManager类的典型用法代码示例。如果您正苦于以下问题:Java ToolManager类的具体用法?Java ToolManager怎么用?Java ToolManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ToolManager类属于org.apache.velocity.tools包,在下文中一共展示了ToolManager类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: transform
import org.apache.velocity.tools.ToolManager; //导入依赖的package包/类
@Override
public ResponseDefinition transform(final Request request,
final ResponseDefinition responseDefinition, final FileSource files,
final Parameters parameters) {
if (responseDefinition.specifiesBodyFile() && templateDeclared(responseDefinition)) {
this.fileSource = files;
final VelocityEngine velocityEngine = new VelocityEngine();
velocityEngine.init();
final ToolManager toolManager = new ToolManager();
toolManager.setVelocityEngine(velocityEngine);
context = toolManager.createContext();
addBodyToContext(request.getBodyAsString());
addHeadersToContext(request.getHeaders());
context.put("requestAbsoluteUrl", request.getAbsoluteUrl());
context.put("requestUrl", request.getUrl());
context.put("requestMethod", request.getMethod());
final String body = getRenderedBody(responseDefinition);
return ResponseDefinitionBuilder.like(responseDefinition).but()
.withBody(body)
.build();
} else {
return responseDefinition;
}
}
开发者ID:adamyork,项目名称:wiremock-velocity-transformer,代码行数:25,代码来源:VelocityResponseTransformer.java
示例2: createContextForLocale
import org.apache.velocity.tools.ToolManager; //导入依赖的package包/类
private Context createContextForLocale(Locale locale) {
EasyFactoryConfiguration config = new EasyFactoryConfiguration();
config.toolbox(Scope.APPLICATION)
.tool(MSG, ResourceTool.class)
.property(BUNDLES, MESSAGES)
.property(LOCALE, locale);
ToolManager manager = new ToolManager(false, false);
manager.configure(config);
return manager.createContext();
}
开发者ID:nkasvosve,项目名称:beyondj,代码行数:12,代码来源:AbstractLocalisedServlet.java
示例3: init
import org.apache.velocity.tools.ToolManager; //导入依赖的package包/类
/**
* initialize required components
*/
@PostConstruct
public void init() {
toolManager = new ToolManager(false, false);
toolManager.setVelocityEngine(velocityEngine);
toolManager.configure("com/communote/server/core/note/template/velocity-toolbox.xml");
propertyManagement.addObjectPropertyFilter(PropertyType.NoteProperty,
PropertyManagement.KEY_GROUP, NOTE_PROPERTY_KEY_TEMPLATE_ID);
propertyManagement.addObjectPropertyFilter(PropertyType.NoteProperty,
PropertyManagement.KEY_GROUP, NOTE_PROPERTY_KEY_TEMPLATE_PROPERTIES);
}
开发者ID:Communote,项目名称:communote-server,代码行数:14,代码来源:NoteTemplateService.java
示例4: VelocityServicesGenerator
import org.apache.velocity.tools.ToolManager; //导入依赖的package包/类
/**
* The constructor.
*
* @param templatePath the classpath location where to look for velocity templates.
*/
public VelocityServicesGenerator( String templatePath )
{
super();
this.engine = new VelocityEngine();
this.engine.setProperty( RuntimeConstants.RESOURCE_LOADER, "classpath" );
this.engine.setProperty( "classpath.resource.loader.class", ClasspathResourceLoader.class.getName() );
this.engine.init();
ToolManager manager = new ToolManager();
this.context = manager.createContext();
this.templatePath = templatePath;
this.template = this.engine.getTemplate( templatePath, ENCODING );
}
开发者ID:mojohaus,项目名称:servicedocgen-maven-plugin,代码行数:19,代码来源:VelocityServicesGenerator.java
示例5: getContext
import org.apache.velocity.tools.ToolManager; //导入依赖的package包/类
public static VelocityContext getContext() {
if (toolManager == null) {
ToolManager newToolManager = new ToolManager();
newToolManager.configure("WEB-INF/velocity-tools.xml");
toolManager = newToolManager;
}
return new VelocityContext(toolManager.createContext());
}
开发者ID:openmash,项目名称:mashmesh,代码行数:10,代码来源:VelocityUtils.java
注:本文中的org.apache.velocity.tools.ToolManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论