コード例 #1
0
  public CFStatementResult Exec(CFContext context) throws cfmRunTimeException {
    setLineCol(context);

    String templatePath = template.EvalFully(context).getString();

    cfSession session = context.getSession();
    cfFile templateFile = cfINCLUDE.loadTemplate(session, templatePath);
    session.write(templateFile.renderToString(session).getOutput());

    return null;
  }
コード例 #2
0
  public static void onApplicationEnd(cfApplicationData appData) {
    String applicationCfcPath = appData.getApplicationCfcPath();
    if (applicationCfcPath == null) return;

    cfSession session =
        new cfSession(
            new dummyServletRequest(appData.getWebroot()),
            new dummyServletResponse(),
            cfEngine.thisServletContext);
    cfComponentData applicationCfc = null;

    try {
      cfFile applicationFile = session.getRealFile(applicationCfcPath);
      applicationFile.setComponentName("Application");

      applicationCfc =
          new cfComponentData(session, applicationFile, false); // false = don't allow abstract

      List<cfApplicationData> args = new ArrayList<cfApplicationData>();
      args.add(appData); // ApplicationScope

      cfcMethodData methodData = new cfcMethodData(session, ON_APPLICATION_END, args);
      applicationCfc.invokeApplicationFunction(session, methodData);

    } catch (cfmAbortException ignore) {
      // do nothing, we're finished anyway (catch here so it's not caught as Throwable below)
    } catch (cfmRunTimeException e) {
      try {
        session.invokeOnError(applicationCfc, e, ON_APPLICATION_END);
      } catch (cfmRunTimeException ie) {
        cfEngine.log("RunTimeError in onApplicationEnd: " + applicationCfcPath);
        ie.handleException(session);
      }
    } catch (Throwable t) {
      com.nary.Debug.printStackTrace(t);
      new cfmRunTimeException(session, t).handleException(session);
    } finally {
      // Make sure per request connections are closed (bug #3174)
      session.sessionEnd();
    }
  }