本文整理了Java中freemarker.core.Environment.isInAttemptBlock()
方法的一些代码示例,展示了Environment.isInAttemptBlock()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Environment.isInAttemptBlock()
方法的具体详情如下:
包路径:freemarker.core.Environment
类名称:Environment
方法名:isInAttemptBlock
[英]Tells if we are inside an #attempt block (but before #recover). This can be useful for TemplateExceptionHandler-s, as then they may don't want to print the error to the output, as #attempt will roll it back anyway.
[中]告诉我们是否在#尝试块内(但在#恢复之前)。这对于TemplateExceptionHandler-s很有用,因为这样他们可能不想将错误打印到输出中,因为#尝试无论如何都会回滚错误。
代码示例来源:origin: org.freemarker/freemarker
public void handleTemplateException(TemplateException te, Environment env, Writer out)
throws TemplateException {
if (!env.isInAttemptBlock()) {
PrintWriter pw = (out instanceof PrintWriter) ? (PrintWriter) out : new PrintWriter(out);
pw.print("FreeMarker template error (DEBUG mode; use RETHROW in production!):\n");
te.printStackTrace(pw, false, true, true);
pw.flush(); // To commit the HTTP response
}
throw te;
}
};
代码示例来源:origin: org.freemarker/freemarker
public void handleTemplateException(TemplateException te, Environment env, Writer out)
throws TemplateException {
if (!env.isInAttemptBlock()) {
boolean externalPw = out instanceof PrintWriter;
PrintWriter pw = externalPw ? (PrintWriter) out : new PrintWriter(out);
代码示例来源:origin: org.freemarker/freemarker
&& !isInAttemptBlock() /* because then the AttemptExceptionReporter will report this */) {
LOG.error("Error executing FreeMarker template", templateException);
} catch (TemplateException e) {
if (isInAttemptBlock()) {
this.getAttemptExceptionReporter().report(templateException, this);
代码示例来源:origin: org.freemarker/freemarker-gae
public void handleTemplateException(TemplateException te, Environment env, Writer out)
throws TemplateException {
if (!env.isInAttemptBlock()) {
PrintWriter pw = (out instanceof PrintWriter) ? (PrintWriter) out : new PrintWriter(out);
pw.print("FreeMarker template error (DEBUG mode; use RETHROW in production!):\n");
te.printStackTrace(pw, false, true, true);
pw.flush(); // To commit the HTTP response
}
throw te;
}
};
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
public void handleTemplateException(TemplateException te, Environment env, Writer out)
throws TemplateException {
if (!env.isInAttemptBlock()) {
PrintWriter pw = (out instanceof PrintWriter) ? (PrintWriter) out : new PrintWriter(out);
pw.print("FreeMarker template error (DEBUG mode; use RETHROW in production!):\n");
te.printStackTrace(pw, false, true, true);
pw.flush(); // To commit the HTTP response
}
throw te;
}
};
代码示例来源:origin: org.freemarker/freemarker-gae
public void handleTemplateException(TemplateException te, Environment env, Writer out)
throws TemplateException {
if (!env.isInAttemptBlock()) {
boolean externalPw = out instanceof PrintWriter;
PrintWriter pw = externalPw ? (PrintWriter) out : new PrintWriter(out);
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
public void handleTemplateException(TemplateException te, Environment env, Writer out)
throws TemplateException {
if (!env.isInAttemptBlock()) {
boolean externalPw = out instanceof PrintWriter;
PrintWriter pw = externalPw ? (PrintWriter) out : new PrintWriter(out);
代码示例来源:origin: org.freemarker/freemarker-gae
&& !isInAttemptBlock() /* because then the AttemptExceptionReporter will report this */) {
LOG.error("Error executing FreeMarker template", templateException);
} catch (TemplateException e) {
if (isInAttemptBlock()) {
this.getAttemptExceptionReporter().report(templateException, this);
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
&& !isInAttemptBlock() /* because then the AttemptExceptionReporter will report this */) {
LOG.error("Error executing FreeMarker template", templateException);
} catch (TemplateException e) {
if (isInAttemptBlock()) {
this.getAttemptExceptionReporter().report(templateException, this);
内容来源于网络,如有侵权,请联系作者删除!