Example usage for org.springframework.security.web FilterChainProxy doFilter

List of usage examples for org.springframework.security.web FilterChainProxy doFilter

Introduction

In this page you can find the example usage for org.springframework.security.web FilterChainProxy doFilter.

Prototype

@Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
            throws IOException, ServletException 

Source Link

Usage

From source file:org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfigurationTests.java

private int getResponseStatus(AssertableWebApplicationContext context, String path)
        throws IOException, javax.servlet.ServletException {
    FilterChainProxy filterChainProxy = context.getBean(FilterChainProxy.class);
    MockServletContext servletContext = new MockServletContext();
    MockHttpServletResponse response = new MockHttpServletResponse();
    servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, context);
    MockHttpServletRequest request = new MockHttpServletRequest(servletContext);
    request.setServletPath(path);/*from   w  ww  .  ja v  a 2 s  .c  o  m*/
    request.setMethod("GET");
    filterChainProxy.doFilter(request, response, new MockFilterChain());
    return response.getStatus();
}