本文整理汇总了Java中org.springframework.boot.web.servlet.ErrorPageRegistry类的典型用法代码示例。如果您正苦于以下问题:Java ErrorPageRegistry类的具体用法?Java ErrorPageRegistry怎么用?Java ErrorPageRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ErrorPageRegistry类属于org.springframework.boot.web.servlet包,在下文中一共展示了ErrorPageRegistry类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: errorPageRegistrar
import org.springframework.boot.web.servlet.ErrorPageRegistry; //导入依赖的package包/类
/**
* @return Error page registry bean
*/
@Bean
public ErrorPageRegistrar errorPageRegistrar() {
return new ErrorPageRegistrar() {
@Override
public void registerErrorPages(ErrorPageRegistry epr) {
epr.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/not-found"));
epr.addErrorPages(new ErrorPage(HttpStatus.FORBIDDEN, "/error/403"));
epr.addErrorPages(new ErrorPage(HttpStatus.UNAUTHORIZED, "/error/403"));
epr.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/error/500"));
epr.addErrorPages(new ErrorPage(HttpStatus.SERVICE_UNAVAILABLE, "/error/503"));
epr.addErrorPages(new ErrorPage(HttpStatus.BAD_REQUEST, "/error/400"));
epr.addErrorPages(new ErrorPage(HttpStatus.METHOD_NOT_ALLOWED, "/error/405"));
epr.addErrorPages(new ErrorPage(Exception.class, "/error/500"));
}
};
}
开发者ID:Erudika,项目名称:scoold,代码行数:20,代码来源:ScooldServer.java
示例2: registerErrorPages
import org.springframework.boot.web.servlet.ErrorPageRegistry; //导入依赖的package包/类
@Override
public void registerErrorPages(@NonNull ErrorPageRegistry registry) {
for (HttpStatus httpStatus : HttpStatus.values()) {
registry.addErrorPages(new ErrorPage(httpStatus,
String.format("/%s/%d", ErrorModule.SERVLET_ERROR_PATH_PREFIX, httpStatus.value())));
}
}
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:8,代码来源:ServletErrorPageRegistrar.java
示例3: registerErrorPages
import org.springframework.boot.web.servlet.ErrorPageRegistry; //导入依赖的package包/类
@Override
public void registerErrorPages(ErrorPageRegistry registry) {
registry.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/"));
}
开发者ID:jrtechnologies,项目名称:yum,代码行数:5,代码来源:ErrorPageConfig.java
示例4: registerErrorPages
import org.springframework.boot.web.servlet.ErrorPageRegistry; //导入依赖的package包/类
@Override
public void registerErrorPages ( ErrorPageRegistry registry ) {
registry.addErrorPages( new ErrorPage( HttpStatus.NOT_FOUND , "/404.html" ) );
registry.addErrorPages( new ErrorPage( HttpStatus.UNAUTHORIZED , "/401.html" ) );
registry.addErrorPages( new ErrorPage( Throwable.class , "/500.html" ) );
}
开发者ID:yujunhao8831,项目名称:spring-boot-start-current,代码行数:7,代码来源:SpringConfig.java
示例5: registerErrorPages
import org.springframework.boot.web.servlet.ErrorPageRegistry; //导入依赖的package包/类
@Override
public void registerErrorPages(ErrorPageRegistry errorPageRegistry) {
ErrorPage errorPage = new ErrorPage(this.properties.getServletPrefix()
+ this.properties.getError().getPath());
errorPageRegistry.addErrorPages(errorPage);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:7,代码来源:ErrorMvcAutoConfiguration.java
示例6: registerErrorPages
import org.springframework.boot.web.servlet.ErrorPageRegistry; //导入依赖的package包/类
@Override
public void registerErrorPages(ErrorPageRegistry errorPageRegistry) {
errorPageRegistry.addErrorPages(new ErrorPage("/spring/error"));
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:5,代码来源:RemappedErrorViewIntegrationTests.java
注:本文中的org.springframework.boot.web.servlet.ErrorPageRegistry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论