Search in sources :

Example 31 with PageContext

use of lucee.runtime.PageContext in project Lucee by lucee.

the class DevNullOutputStream method _invoke.

private Object _invoke(final String methodName, final Object[] args) throws PageException {
    final CFMLEngine engine = CFMLEngineFactory.getInstance();
    final PageContext pc = engine.getThreadPageContext();
    initCFC(pc);
    return cfc.call(pc, methodName, args);
}
Also used : PageContext(lucee.runtime.PageContext) CFMLEngine(lucee.loader.engine.CFMLEngine)

Example 32 with PageContext

use of lucee.runtime.PageContext in project Lucee by lucee.

the class HTTPServletRequestWrap method getParameterMap.

@Override
public Map<String, String[]> getParameterMap() {
    PageContext pc = ThreadLocalPageContext.get();
    FormImpl form = _form(pc);
    URLImpl url = _url(pc);
    return ScopeUtil.getParameterMap(new URLItem[][] { form.getRaw(), url.getRaw() }, new String[] { form.getEncoding(), url.getEncoding() });
}
Also used : UrlFormImpl(lucee.runtime.type.scope.UrlFormImpl) FormImpl(lucee.runtime.type.scope.FormImpl) PageContext(lucee.runtime.PageContext) ThreadLocalPageContext(lucee.runtime.engine.ThreadLocalPageContext) URLImpl(lucee.runtime.type.scope.URLImpl)

Example 33 with PageContext

use of lucee.runtime.PageContext in project Lucee by lucee.

the class RequestDispatcherWrap method forward.

@Override
public void forward(ServletRequest req, ServletResponse rsp) throws ServletException, IOException {
    PageContext pc = ThreadLocalPageContext.get();
    req = HTTPUtil.removeWrap(req);
    if (pc == null) {
        this.req.getOriginalRequestDispatcher(realPath).forward(req, rsp);
        return;
    }
    realPath = HTTPUtil.optimizeRealPath(pc, realPath);
    try {
        RequestDispatcher disp = this.req.getOriginalRequestDispatcher(realPath);
        disp.forward(req, rsp);
    } finally {
        ThreadLocalPageContext.register(pc);
    }
}
Also used : PageContext(lucee.runtime.PageContext) ThreadLocalPageContext(lucee.runtime.engine.ThreadLocalPageContext) RequestDispatcher(javax.servlet.RequestDispatcher)

Example 34 with PageContext

use of lucee.runtime.PageContext in project Lucee by lucee.

the class JavaProxy method call.

public static Object call(ConfigWeb config, Component cfc, String methodName, Object... arguments) {
    boolean unregister = false;
    PageContext pc = null;
    try {
        pc = ThreadLocalPageContext.get();
        // create PageContext if necessary
        if (pc == null) {
            pc = ThreadUtil.createPageContext(config, DevNullOutputStream.DEV_NULL_OUTPUT_STREAM, Constants.NAME, "/", "", null, null, null, null, null, true, -1);
            unregister = true;
            pc.addPageSource(cfc.getPageSource(), true);
        }
        return cfc.call(pc, methodName, arguments);
    } catch (PageException pe) {
        throw new PageRuntimeException(pe);
    } finally {
        if (unregister)
            config.getFactory().releaseLuceePageContext(pc, true);
    }
}
Also used : PageException(lucee.runtime.exp.PageException) PageContext(lucee.runtime.PageContext) ThreadLocalPageContext(lucee.runtime.engine.ThreadLocalPageContext) PageRuntimeException(lucee.runtime.exp.PageRuntimeException)

Example 35 with PageContext

use of lucee.runtime.PageContext in project Lucee by lucee.

the class ScriptEngineImpl method eval.

@Override
public Object eval(String script, ScriptContext context) throws ScriptException {
    if (context == null)
        context = getContext();
    PageContext oldPC = ThreadLocalPageContext.get();
    PageContext pc = getPageContext(context);
    try {
        Result res = factory.tag ? Renderer.tag(pc, script, factory.dialect, false, true) : Renderer.script(pc, script, factory.dialect, false, true);
        return res.getValue();
    } catch (PageException pe) {
        throw toScriptException(pe);
    } finally {
        releasePageContext(pc, oldPC);
    }
}
Also used : PageException(lucee.runtime.exp.PageException) PageContext(lucee.runtime.PageContext) ThreadLocalPageContext(lucee.runtime.engine.ThreadLocalPageContext) Result(lucee.runtime.compiler.Renderer.Result)

Aggregations

PageContext (lucee.runtime.PageContext)44 ThreadLocalPageContext (lucee.runtime.engine.ThreadLocalPageContext)32 PageException (lucee.runtime.exp.PageException)11 Component (lucee.runtime.Component)7 PageContextImpl (lucee.runtime.PageContextImpl)6 IOException (java.io.IOException)5 Key (lucee.runtime.type.Collection.Key)5 Pair (lucee.commons.lang.Pair)4 ConfigWeb (lucee.runtime.config.ConfigWeb)4 Entry (java.util.Map.Entry)3 CFMLEngine (lucee.loader.engine.CFMLEngine)3 CFMLFactory (lucee.runtime.CFMLFactory)3 CFMLFactoryImpl (lucee.runtime.CFMLFactoryImpl)3 ConfigWebImpl (lucee.runtime.config.ConfigWebImpl)3 ArrayList (java.util.ArrayList)2 Cookie (javax.servlet.http.Cookie)2 TypeMapping (javax.xml.rpc.encoding.TypeMapping)2 DevNullOutputStream (lucee.commons.io.DevNullOutputStream)2 ComponentScope (lucee.runtime.ComponentScope)2 Config (lucee.runtime.config.Config)2