org.springframework.boot.web.server.ErrorPageRegistrar Java Examples

The following examples show how to use org.springframework.boot.web.server.ErrorPageRegistrar. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ScooldServer.java    From scoold with Apache License 2.0 6 votes vote down vote up
/**
 * @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/401"));
			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"));
		}
	};
}
 
Example #2
Source File: StartApplication.java    From start.spring.io with Apache License 2.0 5 votes vote down vote up
@Bean
public ErrorPageRegistrar errorPageRegistrar() {
	return (registry) -> {
		registry.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/404.html"));
		registry.addErrorPages(new ErrorPage("/error/index.html"));
	};
}
 
Example #3
Source File: ErrorSpringConfiguration.java    From promregator with Apache License 2.0 4 votes vote down vote up
@Bean
public ErrorPageRegistrar errorPageRegistrar() {
	return new CustomErrorPageRegistrar();
}
 
Example #4
Source File: WebConfig.java    From wetech-admin with MIT License 4 votes vote down vote up
@Bean
public ErrorPageRegistrar myErrorPageRegistrar() {
    return registry -> registry.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/index.html"));
}
 
Example #5
Source File: FallbackConfig.java    From streaming-file-server with MIT License 4 votes vote down vote up
@Bean
public ErrorPageRegistrar errorPageRegistrar() {
  return new MyErrorPageRegistrar();
}