本文整理汇总了Java中org.apache.velocity.context.InternalContextAdapter.get方法的典型用法代码示例。如果您正苦于以下问题:Java InternalContextAdapter.get方法的具体用法?Java InternalContextAdapter.get怎么用?Java InternalContextAdapter.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.velocity.context.InternalContextAdapter
的用法示例。
在下文中一共展示了InternalContextAdapter.get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import org.apache.velocity.context.InternalContextAdapter; //导入方法依赖的package包/类
public boolean render(InternalContextAdapter ctx, Writer writer, Node node) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException {
// get the bean
ValueStack stack = (ValueStack) ctx.get("stack");
HttpServletRequest req = (HttpServletRequest) stack.getContext().get(ServletActionContext.HTTP_REQUEST);
HttpServletResponse res = (HttpServletResponse) stack.getContext().get(ServletActionContext.HTTP_RESPONSE);
Component bean = getBean(stack, req, res);
Container container = (Container) stack.getContext().get(ActionContext.CONTAINER);
container.inject(bean);
// get the parameters
Map params = createPropertyMap(ctx, node);
bean.copyParams(params);
//bean.addAllParameters(params);
bean.start(writer);
if (getType() == BLOCK) {
Node body = node.jjtGetChild(node.jjtGetNumChildren() - 1);
body.render(ctx, writer);
}
bean.end(writer, "");
return true;
}
示例2: render
import org.apache.velocity.context.InternalContextAdapter; //导入方法依赖的package包/类
public boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException {
if(node.jjtGetNumChildren() != 2){
throw new RuntimeException(getName() + " accepts 2 parameters. The first is a boolean value indicating whether or not to add this conditon; the second is a List containing your conditions!") ;
}
Boolean test = (Boolean) node.jjtGetChild(0).value(context) ;
if(Boolean.FALSE.equals(test)){ //ignore this condition.
return true ;
}
Collection conditions = (Collection) node.jjtGetChild(1).value(context) ;
BoundaryChain chain = (BoundaryChain) context.get(GuzzBoundaryDirective.BOUNDARY_CONTEXT_NAME) ;
if(chain == null){
throw new ParseErrorException(getName() + " must be resided inside a guzzBoundary directive.") ;
}
chain.addLimitConditions(conditions) ;
return true;
}
示例3: render
import org.apache.velocity.context.InternalContextAdapter; //导入方法依赖的package包/类
@Override
public boolean render(InternalContextAdapter context, Writer writer,
Node node) throws IOException, ResourceNotFoundException,
ParseErrorException, MethodInvocationException {
Node bodyNode = getBodyNode(context, node);
if (AsynchronousContain.isAsyncConext()) {
StringWriter sw = new StringWriter();
bodyNode.render(context, sw);
PipelineTask task = (PipelineTask) context
.get(PipelineTask.ATTR_KEY);
task.addJsCode(sw.toString());
} else {
writer.write("<script type=\"text/javascript\">\r\n");
bodyNode.render(context, writer);
writer.write("</script>\r\n");
}
return true;
}
示例4: render
import org.apache.velocity.context.InternalContextAdapter; //导入方法依赖的package包/类
@Override
public boolean render(InternalContextAdapter context, Writer writer, Node node)
throws IOException, ResourceNotFoundException, ParseErrorException,
MethodInvocationException {
List placeList=(List) context.get("placeList");
if(placeList==null){
return true;
}
Object value=node.jjtGetChild(0).value(context);
placeList.add(value);
writer.write("?");
return true;
}
示例5: render
import org.apache.velocity.context.InternalContextAdapter; //导入方法依赖的package包/类
public boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException {
if(node.jjtGetNumChildren() != 1){
throw new RuntimeException(getName() + " only and must accept one Map parameter!") ;
}
if(this.slowUpdateService == null){
throw new ResourceNotFoundException("slowUpdateService is not available.") ;
}
Map params = (Map) node.jjtGetChild(0).value(context) ;
Object business = params.get("business") ;
String updatePropName = (String) params.get("updatePropName") ;
int count = TypeConvertHashMap.getIntParam(params, "count", 1) ;
Serializable pkValue = (Serializable) params.get("pkValue") ;
Object tableCondition = params.get("tableCondition") ;
Assert.assertResouceNotNull(business, "parameter [business] in Map is requried.") ;
Assert.assertResouceNotNull(updatePropName, "parameter [updatePropName] in Map is requried.") ;
Assert.assertResouceNotNull(pkValue, "parameter [pkValue] in Map is requried.") ;
String ghostName ;
if(business instanceof java.lang.String){
ghostName = (String) business ;
}else{
ghostName = business.getClass().getName() ;
}
if(tableCondition == null){
BoundaryChain chain = (BoundaryChain) context.get(GuzzBoundaryDirective.BOUNDARY_CONTEXT_NAME) ;
if(chain != null){
tableCondition = chain.getTableCondition() ;
}
}
this.slowUpdateService.updateCount(ghostName, tableCondition, updatePropName, pkValue, count) ;
return true;
}
示例6: getTimeToLive
import org.apache.velocity.context.InternalContextAdapter; //导入方法依赖的package包/类
private int getTimeToLive(InternalContextAdapter context) {
Object timeObj = context.get(PageStaticFilter.PAGE_STATIC_TIME_TO_LIVE);
if (timeObj != null && timeObj instanceof Integer) {
return (Integer) timeObj;
}
return PageStaticFilter.DEF_MAX_LIVE_TIME;
}
示例7: getTimeToDle
import org.apache.velocity.context.InternalContextAdapter; //导入方法依赖的package包/类
private int getTimeToDle(InternalContextAdapter context) {
Object timeObj = context.get(PageStaticFilter.PAGE_STATIC_TIME_TO_DLE);
if (timeObj != null && timeObj instanceof Integer) {
return (Integer) timeObj;
}
return PageStaticFilter.DEF_MAX_DLE_TIME;
}
示例8: getPaageStaticCache
import org.apache.velocity.context.InternalContextAdapter; //导入方法依赖的package包/类
private PageStaticCache getPaageStaticCache(InternalContextAdapter context) {
Object cacheObj = context.get(PageStaticFilter.PAGE_STATIC_CACHE);
if (cacheObj != null && cacheObj instanceof PageStaticCache) {
return (PageStaticCache) cacheObj;
}
return null;
}
示例9: render
import org.apache.velocity.context.InternalContextAdapter; //导入方法依赖的package包/类
public boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException, ResourceNotFoundException, ParseErrorException, MethodInvocationException {
if(node.jjtGetNumChildren() != 1){
throw new RuntimeException(getName() + " only and must accept one Map parameter!") ;
}
Map params = (Map) node.jjtGetChild(0).value(context) ;
Object business = params.get("business") ;
String ghostName ;
if(business instanceof java.lang.String){
ghostName = (String) business ;
}else{
ghostName = business.getClass().getName() ;
}
String var = (String) params.get("var") ;
Object tableCondition = params.get("tableCondition") ;
Object limit = params.get("limit") ;
Assert.assertResouceNotNull(ghostName, "parameter [business] in Map is requried.") ;
Assert.assertResouceNotNull(var, "parameter [var] in Map is requried.") ;
LinkedList conditions = new LinkedList() ;
BoundaryChain chain = (BoundaryChain) context.get(GuzzBoundaryDirective.BOUNDARY_CONTEXT_NAME) ;
if(chain != null){
if(tableCondition == null){
tableCondition = chain.getTableCondition() ;
}
conditions.addAll(chain.getBoundaryLimits()) ;
}
if(limit != null){
conditions.addLast(limit) ;
}
Business bi = guzzContext.getBusiness(ghostName) ;
ObjectMapping mapping = guzzContext.getObjectMappingManager().getObjectMapping(ghostName, tableCondition) ;
if(bi == null){
throw new ParseErrorException("unknown business:[" + business + "], business name:" + ghostName) ;
}
Object result = innerSummonGhosts(bi, mapping, tableCondition, conditions, params);
//保存结果
context.put(var, result) ;
return true;
}