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);
}
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() });
}
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);
}
}
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);
}
}
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);
}
}
Aggregations