Java Code Examples for org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer#addErrorPages()
The following examples show how to use
org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer#addErrorPages() .
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 |
@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: Application.java From youkefu with Apache License 2.0 | 5 votes |
@Bean public EmbeddedServletContainerCustomizer containerCustomizer() { return new EmbeddedServletContainerCustomizer() { @Override public void customize(ConfigurableEmbeddedServletContainer container) { ErrorPage error = new ErrorPage("/error.html"); container.addErrorPages(error); } }; }
Example 3
Source File: WebCustomizerConfig.java From super-cloudops with Apache License 2.0 | 5 votes |
@Bean public EmbeddedServletContainerCustomizer containerCustomizer() { return new EmbeddedServletContainerCustomizer() { @Override public void customize(ConfigurableEmbeddedServletContainer container) { container.addErrorPages(new ErrorPage(HttpStatus.BAD_REQUEST, "/400.html")); container.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500.html")); container.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/404.html")); } }; }
Example 4
Source File: ErrorPageConfig.java From ProxyPool with Apache License 2.0 | 5 votes |
@Override public void customize(ConfigurableEmbeddedServletContainer container) { ErrorPage error400Page = new ErrorPage(HttpStatus.BAD_REQUEST, "/400.html"); 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(error400Page, error401Page, error404Page, error500Page); }
Example 5
Source File: WebConfig.java From easyweb with Apache License 2.0 | 5 votes |
@Bean public EmbeddedServletContainerCustomizer containerCustomizer() { return new EmbeddedServletContainerCustomizer() { @Override public void customize(ConfigurableEmbeddedServletContainer container) { ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/404"); ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500"); container.addErrorPages(error404Page); container.addErrorPages(error500Page); } }; }
Example 6
Source File: CustomizedConfig.java From x-pipe with Apache License 2.0 | 5 votes |
@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 7
Source File: Application.java From spring-boot-quickstart with Apache License 2.0 | 5 votes |
@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 8
Source File: WebConfig.java From jee-universal-bms with Apache License 2.0 | 5 votes |
@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 9
Source File: ErrorPageConfig.java From xxl-conf with GNU General Public License v3.0 | 5 votes |
@Bean public EmbeddedServletContainerCustomizer containerCustomizer() { return new EmbeddedServletContainerCustomizer() { public void customize(ConfigurableEmbeddedServletContainer container) { ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/static/html/500.html"); ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/static/html/500.html"); container.addErrorPages(error404Page, error500Page); } }; }
Example 10
Source File: Bootstrap.java From mywx with Apache License 2.0 | 5 votes |
@Override public void customize(ConfigurableEmbeddedServletContainer container) { container.addErrorPages( new ErrorPage(HttpStatus.BAD_REQUEST, "/error/notfound"), new ErrorPage(HttpStatus.NOT_FOUND, "/error/notfound") ); }
Example 11
Source File: ErrorPageConfig.java From Spring-Boot-Blog with MIT License | 4 votes |
@Override public void customize(ConfigurableEmbeddedServletContainer container) { container.addErrorPages(new ErrorPage(HttpStatus.FORBIDDEN, "/403")); container.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/404")); }
Example 12
Source File: Application.java From celerio-angular-quickstart with Apache License 2.0 | 4 votes |
@Override public void customize(ConfigurableEmbeddedServletContainer container) { container.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/")); }
Example 13
Source File: Application.java From onboard with Apache License 2.0 | 4 votes |
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")); }