org.apache.catalina.Context.addErrorPage()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中org.apache.catalina.Context.addErrorPage()方法的一些代码示例,展示了Context.addErrorPage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Context.addErrorPage()方法的具体详情如下:
包路径:org.apache.catalina.Context
类名称:Context
方法名:addErrorPage

Context.addErrorPage介绍

[英]Add an error page for the specified error or Java exception.
[中]为指定的错误或Java异常添加错误页。

代码示例

代码示例来源:origin: OryxProject/oryx

private static void addErrorPages(Context context) {
 for (int errorCode : ERROR_PAGE_STATUSES) {
  ErrorPage errorPage = new ErrorPage();
  errorPage.setErrorCode(errorCode);
  errorPage.setLocation("/error");
  context.addErrorPage(errorPage);
 }
 ErrorPage errorPage = new ErrorPage();
 errorPage.setExceptionType(Throwable.class.getName());
 errorPage.setLocation("/error");
 context.addErrorPage(errorPage);
}

代码示例来源:origin: org.springframework.boot/spring-boot

public void addToContext(Context context) {
  Assert.state(this.nativePage != null,
      "No Tomcat 8 detected so no native error page exists");
  if (ClassUtils.isPresent(ERROR_PAGE_CLASS, null)) {
    org.apache.tomcat.util.descriptor.web.ErrorPage errorPage = (org.apache.tomcat.util.descriptor.web.ErrorPage) this.nativePage;
    errorPage.setLocation(this.location);
    errorPage.setErrorCode(this.errorCode);
    errorPage.setExceptionType(this.exceptionType);
    context.addErrorPage(errorPage);
  }
  else {
    callMethod(this.nativePage, "setLocation", this.location, String.class);
    callMethod(this.nativePage, "setErrorCode", this.errorCode, int.class);
    callMethod(this.nativePage, "setExceptionType", this.exceptionType,
        String.class);
    callMethod(context, "addErrorPage", this.nativePage,
        this.nativePage.getClass());
  }
}

代码示例来源:origin: myrrix/myrrix-recommender

private static void addErrorPages(Context context) {
 for (int errorCode : ERROR_PAGE_STATUSES) {
  ErrorPage errorPage = new ErrorPage();
  errorPage.setErrorCode(errorCode);
  errorPage.setLocation("/error.jspx");
  context.addErrorPage(errorPage);
 }
 ErrorPage errorPage = new ErrorPage();
 errorPage.setExceptionType(Throwable.class.getName());
 errorPage.setLocation("/error.jspx");
 context.addErrorPage(errorPage);
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

context.addErrorPage(errorPage);

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

context.addErrorPage(errorPage);

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

context.addErrorPage(errorPage);

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

context.addErrorPage(errorPage);

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

context.addErrorPage(errorPage);

代码示例来源:origin: codefollower/Tomcat-Research

context.addErrorPage(errorPage);

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

context.addErrorPage(errorPage);

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

context.addErrorPage(errorPage);

代码示例来源:origin: org.jboss.jbossas/jboss-as-tomcat

errorPage.setExceptionType(value.getExceptionType());
errorPage.setLocation(value.getLocation());
context.addErrorPage(errorPage);

相关文章

Context类方法