Search in sources :

Example 1 with GenericFilterBean

use of org.springframework.web.filter.GenericFilterBean in project cloudbreak by hortonworks.

the class AppConfig method turnOnStackUnderOperationService.

@Bean
public FilterRegistrationBean turnOnStackUnderOperationService() {
    FilterRegistrationBean registration = new FilterRegistrationBean();
    registration.setFilter(new GenericFilterBean() {

        @Override
        public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
            stackUnderOperationService.on();
            chain.doFilter(request, response);
            stackUnderOperationService.off();
        }
    });
    registration.addUrlPatterns("/*");
    return registration;
}
Also used : GenericFilterBean(org.springframework.web.filter.GenericFilterBean) ServletException(javax.servlet.ServletException) ServletRequest(javax.servlet.ServletRequest) ServletResponse(javax.servlet.ServletResponse) FilterChain(javax.servlet.FilterChain) IOException(java.io.IOException) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) GenericFilterBean(org.springframework.web.filter.GenericFilterBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

IOException (java.io.IOException)1 FilterChain (javax.servlet.FilterChain)1 ServletException (javax.servlet.ServletException)1 ServletRequest (javax.servlet.ServletRequest)1 ServletResponse (javax.servlet.ServletResponse)1 FilterRegistrationBean (org.springframework.boot.web.servlet.FilterRegistrationBean)1 Bean (org.springframework.context.annotation.Bean)1 GenericFilterBean (org.springframework.web.filter.GenericFilterBean)1