Search in sources :

Example 6 with PageServletException

use of lucee.runtime.exp.PageServletException in project Lucee by lucee.

the class BodyTagTryCatchFinallySupport method doCatch.

/**
 * @see javax.servlet.jsp.tagext.TryCatchFinally#doCatch(java.lang.Throwable)
 */
@Override
public void doCatch(Throwable t) throws Throwable {
    if (t instanceof PageServletException) {
        final PageServletException pse = (PageServletException) t;
        t = pse.getPageException();
    }
    if (bodyContent != null) {
        final Excepton util = CFMLEngineFactory.getInstance().getExceptionUtil();
        if (util.isOfType(Excepton.TYPE_ABORT, t))
            bodyContent.writeOut(bodyContent.getEnclosingWriter());
        bodyContent.clearBuffer();
    }
    throw t;
}
Also used : Excepton(lucee.runtime.util.Excepton) PageServletException(lucee.runtime.exp.PageServletException)

Example 7 with PageServletException

use of lucee.runtime.exp.PageServletException in project Lucee by lucee.

the class HTTPUtil method forward.

public static void forward(PageContext pc, String realPath) throws ServletException, IOException {
    ServletContext context = pc.getServletContext();
    realPath = HTTPUtil.optimizeRealPath(pc, realPath);
    try {
        pc.getHttpServletRequest().setAttribute("lucee.forward.request_uri", realPath);
        RequestDispatcher disp = context.getRequestDispatcher(realPath);
        if (disp == null)
            throw new PageServletException(new ApplicationException("Page " + realPath + " not found"));
        // populateRequestAttributes();
        disp.forward(removeWrap(pc.getHttpServletRequest()), pc.getHttpServletResponse());
    } finally {
        ThreadLocalPageContext.register(pc);
    }
}
Also used : ApplicationException(lucee.runtime.exp.ApplicationException) ServletContext(javax.servlet.ServletContext) PageServletException(lucee.runtime.exp.PageServletException) RequestDispatcher(javax.servlet.RequestDispatcher)

Aggregations

PageServletException (lucee.runtime.exp.PageServletException)7 ApplicationException (lucee.runtime.exp.ApplicationException)3 IOException (java.io.IOException)2 ServletContext (javax.servlet.ServletContext)2 PageException (lucee.runtime.exp.PageException)2 PrintWriter (java.io.PrintWriter)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 RequestDispatcher (javax.servlet.RequestDispatcher)1 ServletException (javax.servlet.ServletException)1 ServletRequest (javax.servlet.ServletRequest)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 Resource (lucee.commons.io.res.Resource)1 ResourceProvider (lucee.commons.io.res.ResourceProvider)1 CFMLFactoryImpl (lucee.runtime.CFMLFactoryImpl)1 PageContextImpl (lucee.runtime.PageContextImpl)1 AbortException (lucee.runtime.exp.AbortException)1 NativeException (lucee.runtime.exp.NativeException)1 RequestTimeoutException (lucee.runtime.exp.RequestTimeoutException)1 Struct (lucee.runtime.type.Struct)1 StructImpl (lucee.runtime.type.StructImpl)1