use of lucee.runtime.PageSource in project Lucee by lucee.
the class FDSignal method createExceptionStack.
public static List createExceptionStack(PageException pe) {
StackTraceElement[] traces = pe.getStackTrace();
PageContextImpl pc = (PageContextImpl) ThreadLocalPageContext.get();
String template = "";
StackTraceElement trace = null;
List list = new ArrayList();
Resource res;
PageSource ps;
FDStackFrameImpl frame;
for (int i = traces.length - 1; i >= 0; i--) {
trace = traces[i];
ps = null;
if (trace.getLineNumber() <= 0)
continue;
template = trace.getFileName();
if (template == null || ResourceUtil.getExtension(template, "").equals("java"))
continue;
res = ResourceUtil.toResourceNotExisting(pc, template);
ps = pc.toPageSource(res, null);
frame = new FDStackFrameImpl(null, pc, trace, ps);
if (ASMUtil.isOverfowMethod(trace.getMethodName()))
list.set(0, frame);
else
list.add(0, frame);
}
if (pe instanceof TemplateException) {
TemplateException te = (TemplateException) pe;
if (te.getPageSource() != null)
list.add(0, new FDStackFrameImpl(null, pc, te.getPageSource(), te.getLine()));
}
return list;
}
use of lucee.runtime.PageSource in project Lucee by lucee.
the class FDThreadImpl method getStack.
@Override
public List<IFDStackFrame> getStack() {
List<PageSource> stack = pc.getPageSourceList();
StackTraceElement[] traces = pc.getThread().getStackTrace();
String template = "";
StackTraceElement trace = null;
ArrayList<IFDStackFrame> list = new ArrayList<IFDStackFrame>();
PageSource ps;
int index = stack.size();
for (int i = traces.length - 1; i >= 0; i--) {
trace = traces[i];
ps = null;
if (trace.getLineNumber() <= 0)
continue;
template = trace.getFileName();
if (template == null || ResourceUtil.getExtension(template, "").equals("java"))
continue;
if (index > 0)
ps = stack.get(--index);
if (ps == null || !isEqual(ps, trace)) {
ps = toPageSource(pc, template);
}
FDStackFrameImpl frame = new FDStackFrameImpl(this, pc, trace, ps);
if (ASMUtil.isOverfowMethod(trace.getMethodName()))
list.set(0, frame);
else
list.add(0, frame);
}
return list;
}
use of lucee.runtime.PageSource in project Lucee by lucee.
the class FDThreadImpl method getTopStackFrame.
@Override
public IFDStackFrame getTopStackFrame() {
PageSource ps = pc.getCurrentPageSource();
StackTraceElement[] traces = pc.getThread().getStackTrace();
String template = "";
StackTraceElement trace = null;
for (int i = 0; i < traces.length; i++) {
trace = traces[i];
if (trace.getLineNumber() <= 0)
continue;
template = trace.getFileName();
if (template == null || ResourceUtil.getExtension(template, "").equals("java"))
continue;
if (ps == null || !isEqual(ps, trace)) {
ps = toPageSource(pc, template);
}
break;
}
return new FDStackFrameImpl(this, pc, trace, ps);
}
use of lucee.runtime.PageSource in project Lucee by lucee.
the class CFMLEngineImpl method serviceFile.
@Override
public void serviceFile(HttpServlet servlet, HttpServletRequest req, HttpServletResponse rsp) throws ServletException, IOException {
req = new HTTPServletRequestWrap(req);
CFMLFactory factory = getCFMLFactory(servlet.getServletConfig(), req);
ConfigWeb config = factory.getConfig();
PageSource ps = config.getPageSourceExisting(null, null, req.getServletPath(), false, true, true, false);
if (ps == null) {
rsp.sendError(404);
} else {
Resource res = ps.getResource();
if (res == null) {
rsp.sendError(404);
} else {
ReqRspUtil.setContentLength(rsp, res.length());
String mt = servlet.getServletContext().getMimeType(req.getServletPath());
if (!StringUtil.isEmpty(mt))
ReqRspUtil.setContentType(rsp, mt);
IOUtil.copy(res, rsp.getOutputStream(), true);
}
}
}
use of lucee.runtime.PageSource in project Lucee by lucee.
the class PageExceptionImpl method getTagContext.
public static Array getTagContext(Config config, StackTraceElement[] traces) {
Array tagContext = new ArrayImpl();
_getTagContext(config, tagContext, traces, new LinkedList<PageSource>());
return tagContext;
}
Aggregations