initCFC(pc);
return cfc.call(pc, methodName, args);
}
private Object _invoke(String methodName, Object[] args, HttpServletRequest req, HttpServletResponse rsp, OutputStream out) throws PageException {
CFMLEngine engine = CFMLEngineFactory.getInstance();
Creation creator = engine.getCreationUtil();
PageContext originalPC = engine.getThreadPageContext();
// no OutputStream
if(out==null)out=DevNullOutputStream.DEV_NULL_OUTPUT_STREAM;
// no Request
if(req==null){
// TODO new File
req=creator.createHttpServletRequest(new File("."), "Railo", "/", "", null, null, null, null, null);
}
// noRespone
if(rsp==null){
rsp=creator.createHttpServletResponse(out);
}
PageContext pc = creator.createPageContext(req,rsp,out);
try{
engine.registerThreadPageContext(pc);
initCFC(pc);
return cfc.call(pc, methodName, args);
}
finally{
if(autoFlush) {
try {
pc.getRootWriter().flush();
} catch (Throwable t) {}
}
engine.registerThreadPageContext(originalPC);
}
}