Search in sources :

Example 1 with WebContext

use of org.nuxeo.ecm.webengine.model.WebContext in project nuxeo-filesystem-connectors by nuxeo.

the class AbstractBackendFactory method getBackend.

@Override
public Backend getBackend(String path, HttpServletRequest request) {
    if (request == null) {
        throw new NullPointerException("null request");
    }
    Backend backend = (Backend) request.getAttribute(WIRequestFilter.BACKEND_KEY);
    if (backend == null) {
        // create backend from WebEngine session
        WebContext webContext = WebEngine.getActiveContext();
        if (webContext == null) {
            throw new NullPointerException("null WebContext");
        }
        CoreSession session = webContext.getCoreSession();
        if (session == null) {
            throw new NullPointerException("null CoreSession");
        }
        backend = createRootBackend(session);
        request.setAttribute(WIRequestFilter.BACKEND_KEY, backend);
    }
    return backend.getBackend(path);
}
Also used : WebContext(org.nuxeo.ecm.webengine.model.WebContext) CoreSession(org.nuxeo.ecm.core.api.CoreSession)

Aggregations

CoreSession (org.nuxeo.ecm.core.api.CoreSession)1 WebContext (org.nuxeo.ecm.webengine.model.WebContext)1