List of usage examples for org.apache.commons.jxpath.servlet KeywordVariables KeywordVariables
public KeywordVariables(String keyword, Object object)
From source file:org.apache.cocoon.jxpath.JXPathCocoonContexts.java
/** * Returns a JXPathContext bound to the "request" scope. * Caches that context within the request itself. *//*from ww w.jav a2s . co m*/ public final JXPathContext getRequestContext() { final Map objectModel = ContextHelper.getObjectModel(this.context); Request request = ObjectModelHelper.getRequest(objectModel); JXPathContext context = (JXPathContext) request.getAttribute(Constants.JXPATH_CONTEXT); if (context == null) { Context envContext = ObjectModelHelper.getContext(objectModel); JXPathContext parentContext = null; Session session = request.getSession(false); if (session != null) { parentContext = getSessionContext(session, envContext); } else { parentContext = getApplicationContext(envContext); } request = new RequestProxy(request); context = factory.newContext(parentContext, request); context.setVariables(new KeywordVariables(Constants.REQUEST_SCOPE, request)); request.setAttribute(Constants.JXPATH_CONTEXT, context); } return context; }
From source file:org.apache.cocoon.jxpath.JXPathCocoonContexts.java
/** * Returns a JXPathContext bound to the "session" scope. * Caches that context within the session itself. *///from ww w .j a v a2 s . c o m public final JXPathContext getSessionContext(Session session, Context envContext) { JXPathContext context = (JXPathContext) session.getAttribute(Constants.JXPATH_CONTEXT); if (context == null) { JXPathContext parentContext = getApplicationContext(envContext); session = new SessionProxy(session); context = factory.newContext(parentContext, session); context.setVariables(new KeywordVariables(Constants.SESSION_SCOPE, session)); session.setAttribute(Constants.JXPATH_CONTEXT, context); } return context; }
From source file:org.apache.cocoon.jxpath.JXPathCocoonContexts.java
/** * Returns a JXPathContext bound to the "application" scope. Caches that context * within the servlet context itself./*from ww w . j a va 2s.c om*/ */ public final JXPathContext getApplicationContext(Context envContext) { JXPathContext context = (JXPathContext) envContext.getAttribute(Constants.JXPATH_CONTEXT); if (context == null) { envContext = new ContextProxy(envContext); context = factory.newContext(null, envContext); context.setVariables(new KeywordVariables(Constants.APPLICATION_SCOPE, envContext)); envContext.setAttribute(Constants.JXPATH_CONTEXT, context); } return context; }