Search in sources :

Example 1 with ErrorPage

use of org.springframework.boot.context.embedded.ErrorPage in project microservices by pwillhan.

the class WebConfig method containerCustomizer.

@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
    return new EmbeddedServletContainerCustomizer() {

        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            // TODO Auto-generated method stub
            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);
        }
    };
}
Also used : ErrorPage(org.springframework.boot.context.embedded.ErrorPage) ConfigurableEmbeddedServletContainer(org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer) EmbeddedServletContainerCustomizer(org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer) Bean(org.springframework.context.annotation.Bean)

Example 2 with ErrorPage

use of org.springframework.boot.context.embedded.ErrorPage in project x-pipe by ctripcorp.

the class CustomizedConfig method containerCustomizer.

@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
    return new EmbeddedServletContainerCustomizer() {

        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            ErrorPage error401Page = new ErrorPage(HttpStatus.UNAUTHORIZED, "/401.html");
            container.addErrorPages(error401Page);
        }
    };
}
Also used : ErrorPage(org.springframework.boot.context.embedded.ErrorPage) ConfigurableEmbeddedServletContainer(org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer) EmbeddedServletContainerCustomizer(org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer) Bean(org.springframework.context.annotation.Bean)

Aggregations

ConfigurableEmbeddedServletContainer (org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer)2 EmbeddedServletContainerCustomizer (org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer)2 ErrorPage (org.springframework.boot.context.embedded.ErrorPage)2 Bean (org.springframework.context.annotation.Bean)2