diff --git a/spring-boot-docs/src/main/asciidoc/howto.adoc b/spring-boot-docs/src/main/asciidoc/howto.adoc index f4887974326..bc68371e6c9 100644 --- a/spring-boot-docs/src/main/asciidoc/howto.adoc +++ b/spring-boot-docs/src/main/asciidoc/howto.adoc @@ -1348,7 +1348,7 @@ in the ``Production-ready features'' section. [[howto-customize-the-whitelabel-error-page]] === Customize the ``whitelabel'' error page -The Actuator installs a ``whitelabel'' error page that you will see in browser client if +Spring Boot installs a ``whitelabel'' error page that you will see in browser client if you encounter a server error (machine clients consuming JSON and other media types should see a sensible response with the right error code). To switch it off you can set `error.whitelabel.enabled=false`, but normally in addition or alternatively to that you @@ -1361,6 +1361,8 @@ of the default configuration you should find a `BeanNameViewResolver` in your `ApplicationContext` so a `@Bean` with id `error` would be a simple way of doing that. Look at {sc-spring-boot-autoconfigure}/web/ErrorMvcAutoConfiguration.{sc-ext}[`ErrorMvcAutoConfiguration`] for more options. +See also the section on <> for details of +how to register handlers in the servlet container. [[howto-security]] diff --git a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index 8dc9eee9ff9..15a9fdc65e3 100644 --- a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -1001,6 +1001,24 @@ You can also use regular Spring MVC features like http://docs.spring.io/spring/d methods] and http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#mvc-ann-controller-advice[`@ControllerAdvice`]. The `ErrorController` will then pick up any unhandled exceptions. +N.B. if you register an `ErrorPage` with a path that will end up being handled by a `Filter` (e.g. as is common with some non-Spring web frameworks, +like Jersey and Wicket), then the `Filter` has to be explicitly registered as an `ERROR` dispatcher, e.g. + +[source,java,indent=0,subs="verbatim,quotes,attributes"] +---- +@Bean +public FilterRegistrationBean myFilter() { + + FilterRegistrationBean registration = new FilterRegistrationBean(); + registration.setFilter(new MyFilter()); + ... + registration.setDispatcherTypes(EnumSet.allOf(DispatcherType.class)); + return registration; + +} +---- + +(the default `FilterRegistrationBean` does not include the `ERROR` dispatcher type). [[boot-features-embedded-container]]