use of lucee.runtime.PageContext in project Lucee by lucee.
the class GatewayEngineImpl method call.
public Object call(String cfcPath, String id, String functionName, Struct arguments, boolean cfcPeristent, Object defaultValue) throws PageException {
String requestURI = toRequestURI(cfcPath);
PageContext oldPC = ThreadLocalPageContext.get();
PageContextImpl pc = null;
try {
pc = createPageContext(requestURI, id, functionName, arguments, cfcPeristent, true);
String ext = ResourceUtil.getExtension(cfcPath, null);
ConfigWeb config = (ConfigWeb) ThreadLocalPageContext.getConfig();
int dialect = ext == null ? CFMLEngine.DIALECT_CFML : config.getFactory().toDialect(ext);
// ThreadLocalPageContext.register(pc);
Component cfc = getCFC(pc, requestURI);
if (cfc.containsKey(functionName)) {
if (dialect == CFMLEngine.DIALECT_LUCEE)
pc.execute(requestURI, true, false);
else
pc.executeCFML(requestURI, true, false);
// Result
return pc.variablesScope().get(AMF_FORWARD, null);
}
} finally {
CFMLFactory f = config.getFactory();
f.releaseLuceePageContext(pc, true);
ThreadLocalPageContext.register(oldPC);
}
return defaultValue;
}
use of lucee.runtime.PageContext in project Lucee by lucee.
the class GatewayEngineImpl method getComponent.
public Object getComponent(String cfcPath, String id) throws PageException {
String requestURI = toRequestURI(cfcPath);
PageContext oldPC = ThreadLocalPageContext.get();
PageContextImpl pc = null;
try {
pc = createPageContext(requestURI, id, "init", null, false, true);
// ThreadLocalPageContext.register(pc);
return getCFC(pc, requestURI);
} finally {
CFMLFactory f = config.getFactory();
f.releaseLuceePageContext(pc, true);
ThreadLocalPageContext.register(oldPC);
}
}
use of lucee.runtime.PageContext in project Lucee by lucee.
the class ComponentProvider method invokeMethod.
@Override
protected Object invokeMethod(MessageContext mc, Method method, Object trg, Object[] args) throws Exception {
PageContext pc = (PageContext) mc.getProperty(Constants.PAGE_CONTEXT);
Component c = (Component) mc.getProperty(Constants.COMPONENT);
RPCServer server = RPCServer.getInstance(pc.getId(), pc, pc.getServletContext());
// TypeMappingUtil.getServerTypeMapping(server.getEngine().getTypeMappingRegistry());
TypeMapping tm = mc.getTypeMapping();
return AxisCaster.toAxisType(tm, c.call(pc, method.getName(), toLuceeType(pc, args)), null);
}
use of lucee.runtime.PageContext in project Lucee by lucee.
the class CreationImpl method createPageContext.
@Override
public PageContext createPageContext(HttpServletRequest req, HttpServletResponse rsp, OutputStream out) {
Config config = ThreadLocalPageContext.getConfig();
if (!(config instanceof ConfigWeb))
throw new RuntimeException("need a web context to create a PageContext");
CFMLFactory factory = ((ConfigWeb) config).getFactory();
return (PageContext) factory.getPageContext(factory.getServlet(), req, rsp, null, false, -1, false);
}
use of lucee.runtime.PageContext in project Lucee by lucee.
the class FTPResource method setLastModified.
@Override
public boolean setLastModified(long time) {
// if(isRoot()) return false;
FTPResourceClient client = null;
try {
provider.lock(this);
client = provider.getClient(data);
PageContext pc = ThreadLocalPageContext.get();
Calendar c = JREDateTimeUtil.getThreadCalendar();
if (pc != null)
c.setTimeZone(pc.getTimeZone());
c.setTimeInMillis(time);
FTPFile file = client.getFTPFile(this);
if (file == null)
return false;
file.setTimestamp(c);
client.unregisterFTPFile(this);
return true;
} catch (IOException e) {
} finally {
provider.returnClient(client);
provider.unlock(this);
}
return false;
}
Aggregations