org.springframework.boot.web.servlet.ErrorPage Java Examples
The following examples show how to use
org.springframework.boot.web.servlet.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: AppConfiguration.java From find with MIT License | 6 votes |
@SuppressWarnings("ReturnOfInnerClass") @Bean public EmbeddedServletContainerCustomizer containerCustomizer( @Value("${server.tomcat.accesslog.pattern:combined}") final String pattern ) { return container -> { final ErrorPage error401Page = new ErrorPage(HttpStatus.UNAUTHORIZED, DispatcherServletConfiguration.AUTHENTICATION_ERROR_PATH); final ErrorPage error403Page = new ErrorPage(HttpStatus.FORBIDDEN, DispatcherServletConfiguration.AUTHENTICATION_ERROR_PATH); final ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, DispatcherServletConfiguration.NOT_FOUND_ERROR_PATH); final ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, DispatcherServletConfiguration.SERVER_ERROR_PATH); container.addErrorPages(error401Page, error403Page, error404Page, error500Page); if (StringUtils.isNotEmpty(pattern) && container instanceof TomcatEmbeddedServletContainerFactory) { final TomcatAccessLogValve accessLogValve = new TomcatAccessLogValve(); accessLogValve.setPattern(pattern); ((TomcatEmbeddedServletContainerFactory) container).addEngineValves(accessLogValve); } }; }
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: WebMvcConfig.java From NoteBlog with MIT License | 5 votes |
@Bean public EmbeddedServletContainerCustomizer containerCustomizer() { return container -> { container.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/error?errorCode=404")); container.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/error?errorCode=500")); container.addErrorPages(new ErrorPage(Throwable.class, "/error?errorCode=500")); }; }
Example #5
Source File: AdminApplication.java From JavaQuarkBBS with Apache License 2.0 | 5 votes |
@Bean public EmbeddedServletContainerCustomizer containerCustomizer() { 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 #6
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 #7
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 #8
Source File: SpringVueDemoApplication.java From spring-vue-demo with MIT License | 5 votes |
@Bean public EmbeddedServletContainerCustomizer containerCustomizer() { return (container -> { ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/404.html"); container.addErrorPages(error404Page); }); }
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: UiApplication.java From spring-5-examples with MIT License | 4 votes |
@Bean public EmbeddedServletContainerCustomizer embeddedServletContainerCustomizer() { return container -> container.addErrorPages( new ErrorPage(NOT_FOUND, "/404") ); }
Example #11
Source File: UiApplication.java From spring-5-examples with MIT License | 4 votes |
@Bean public EmbeddedServletContainerCustomizer embeddedServletContainerCustomizer() { return container -> container.addErrorPages( new ErrorPage(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: ErrorPageConfig.java From tutorials with MIT License | 4 votes |
@Override public void registerErrorPages(ErrorPageRegistry registry) { registry.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/home/index.html")); }