org.springframework.boot.context.embedded.ErrorPage Java Examples

The following examples show how to use org.springframework.boot.context.embedded.ErrorPage. 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: WebAppConfig.java    From tinker-manager with Apache License 2.0 6 votes vote down vote up
@Bean
    public EmbeddedServletContainerCustomizer containerCustomizer() {
        return new EmbeddedServletContainerCustomizer() {
            @Override
            public void customize(ConfigurableEmbeddedServletContainer container) {
                ErrorPage page404 = new ErrorPage(HttpStatus.NOT_FOUND,"/404");
                container.addErrorPages(page404);
            }
        };
//        return (container -> {
//            ErrorPage error401Page = new ErrorPage(HttpStatus.UNAUTHORIZED, "/401.html");
//            ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/404.html");
//            ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500.html");
//
//            container.addErrorPages(error401Page, error404Page, error500Page);
//        });
    }
 
Example #2
Source File: CustomizedConfig.java    From x-pipe with Apache License 2.0 5 votes vote down vote up
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
	return new EmbeddedServletContainerCustomizer() {
		@Override
		public void customize(ConfigurableEmbeddedServletContainer container) {
			ErrorPage error401Page = new ErrorPage(HttpStatus.UNAUTHORIZED, "/401.html");
			
			container.addErrorPages(error401Page);
		}
	}; 
}
 
Example #3
Source File: Application.java    From spring-boot-quickstart with Apache License 2.0 5 votes vote down vote up
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
    return new EmbeddedServletContainerCustomizer() {
        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            ErrorPage error401Page = new ErrorPage(HttpStatus.UNAUTHORIZED, "/WEB-INF/views/error/401.jsp");
            ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/WEB-INF/views/error/404.jsp");
            ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/WEB-INF/views/error/500.jsp");

            container.addErrorPages(error401Page, error404Page, error500Page);
        }
    };
}
 
Example #4
Source File: WebConfig.java    From jee-universal-bms with Apache License 2.0 5 votes vote down vote up
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
    return new EmbeddedServletContainerCustomizer() {
        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {

            ErrorPage error403Page = new ErrorPage(HttpStatus.FORBIDDEN, "/403.html");
            ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/404.html");
            ErrorPage error405Page = new ErrorPage(HttpStatus.METHOD_NOT_ALLOWED, "/405.html");
            ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500.html");

            container.addErrorPages(error403Page, error404Page, error405Page, error500Page);
        }
    };
}
 
Example #5
Source File: Bootstrap.java    From mywx with Apache License 2.0 5 votes vote down vote up
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    container.addErrorPages(
            new ErrorPage(HttpStatus.BAD_REQUEST, "/error/notfound"),
            new ErrorPage(HttpStatus.NOT_FOUND, "/error/notfound")
    );
}
 
Example #6
Source File: ErrorPageConfig.java    From Spring-Boot-Blog with MIT License 4 votes vote down vote up
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    container.addErrorPages(new ErrorPage(HttpStatus.FORBIDDEN, "/403"));
    container.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/404"));
}
 
Example #7
Source File: Application.java    From onboard with Apache License 2.0 4 votes vote down vote up
public void customize(ConfigurableEmbeddedServletContainer container) {
    container.addErrorPages(new ErrorPage(HttpStatus.BAD_REQUEST, "/error/404"));
    container.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/error/404"));
    container.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/error/500"));
    container.addErrorPages(new ErrorPage(HttpStatus.FORBIDDEN, "/error/403"));
}