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

The following examples show how to use org.springframework.boot.web.server.ErrorPageRegistry. 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: ErrorPageConfig.java    From kvf-admin with MIT License 5 votes vote down vote up
@Override
public void registerErrorPages(ErrorPageRegistry registry) {
    ErrorPage error400Page = new ErrorPage(HttpStatus.BAD_REQUEST, "/400");
    ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/404");
    ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500");
    registry.addErrorPages(error400Page, error404Page, error500Page);
}
 
Example #3
Source File: ErrorPageConfiguration.java    From yshopmall with Apache License 2.0 5 votes vote down vote up
@Override
public void registerErrorPages(ErrorPageRegistry errorPageRegistry) {
  errorPageRegistry.addErrorPages(
      new ErrorPage(HttpStatus.NOT_FOUND, "/error/404"),
      new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/error/500")
  );
}
 
Example #4
Source File: ErrorPageConfiguration.java    From black-shop with Apache License 2.0 5 votes vote down vote up
@Override
public void registerErrorPages(ErrorPageRegistry errorPageRegistry) {
  errorPageRegistry.addErrorPages(
      new ErrorPage(HttpStatus.NOT_FOUND, "/error/404"),
      new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/error/500")
  );
}
 
Example #5
Source File: MVCConfiguration.java    From seed with Apache License 2.0 5 votes vote down vote up
@Override
public void registerErrorPages(ErrorPageRegistry registry) {
    ErrorPage[] errorPages = new ErrorPage[2];
    errorPages[0] = new ErrorPage(HttpStatus.NOT_FOUND, "/WEB-INF/jsp/common/404.jsp");
    errorPages[1] = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/WEB-INF/jsp/common/500.jsp");
    registry.addErrorPages(errorPages);
}
 
Example #6
Source File: JboneErrorPageRegister.java    From jbone with Apache License 2.0 5 votes vote down vote up
@Override
public void registerErrorPages(ErrorPageRegistry errorPageRegistry) {
    ErrorPage e404 = new ErrorPage(HttpStatus.NOT_FOUND, "/errors/404.html");
    ErrorPage e500 = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/errors/500.html");

    ErrorPage ticketValidateError = new ErrorPage(TicketValidationException.class,"/errors/ticketValidateError.html");
    errorPageRegistry.addErrorPages(ticketValidateError,e404, e500);
}
 
Example #7
Source File: ErrorConfigurar.java    From wangmarket with Apache License 2.0 5 votes vote down vote up
public void registerErrorPages(ErrorPageRegistry registry) {
	ErrorPage[] errorPages=new ErrorPage[3];
       errorPages[0]=new ErrorPage(HttpStatus.NOT_FOUND,"/404.do");
       errorPages[1]=new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR,"/500.do");
       //errorPages[2]=new ErrorPage(HttpStatus.NOT_ACCEPTABLE,"/406.do");
       //errorPages[3]=new ErrorPage(org.apache.shiro.authz.AuthorizationException.class, "/403.do");	//优先根据此来进行排查。 先根据具体异常的类、再根据错误码
       errorPages[2]=new ErrorPage(org.springframework.web.multipart.MaxUploadSizeExceededException.class, "/406.do");	//
       
       
       registry.addErrorPages(errorPages);
}
 
Example #8
Source File: ErrorConfig.java    From White-Jotter with MIT License 4 votes vote down vote up
@Override
public void registerErrorPages(ErrorPageRegistry registry) {
    ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/index.html");
    registry.addErrorPages(error404Page);
}
 
Example #9
Source File: ErrorSpringConfiguration.java    From promregator with Apache License 2.0 4 votes vote down vote up
@Override
public void registerErrorPages(ErrorPageRegistry registry) {
	registry.addErrorPages(new ErrorPage(HttpStatus.UNAUTHORIZED, "/errors/401.html"));
	registry.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/errors/500.html"));
}
 
Example #10
Source File: SpringConfig.java    From spring-boot-start-current with Apache License 2.0 4 votes vote down vote up
@Override
public void registerErrorPages ( ErrorPageRegistry registry ) {
    registry.addErrorPages( new ErrorPage( HttpStatus.NOT_FOUND , "/404" ) );
    registry.addErrorPages( new ErrorPage( HttpStatus.UNAUTHORIZED , "/401" ) );
    registry.addErrorPages( new ErrorPage( Throwable.class , "/500" ) );
}
 
Example #11
Source File: FallbackConfig.java    From streaming-file-server with MIT License 4 votes vote down vote up
@Override
public void registerErrorPages(final ErrorPageRegistry registry) {
  registry.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/404"));
}
 
Example #12
Source File: ErrorConfig.java    From Blog with Apache License 2.0 2 votes vote down vote up
/**
 * 有匹配的路径,但是该路径下的资源不存在
 *
 * @param registry
 */
@Override
public void registerErrorPages(ErrorPageRegistry registry) {
    registry.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/notfound"));
}