Example usage for org.apache.commons.jxpath.servlet Constants SESSION_SCOPE

List of usage examples for org.apache.commons.jxpath.servlet Constants SESSION_SCOPE

Introduction

In this page you can find the example usage for org.apache.commons.jxpath.servlet Constants SESSION_SCOPE.

Prototype

String SESSION_SCOPE

To view the source code for org.apache.commons.jxpath.servlet Constants SESSION_SCOPE.

Click Source Link

Document

Variable name for javax.servlet.http.HttpSession .

Usage

From source file:org.apache.cocoon.jxpath.JXPathCocoonContexts.java

/**
 * Returns a JXPathContext bound to the "session" scope.
 * Caches that context within the session itself.
 *///w w w . j  av a 2 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;
}