title: Get HttpServletRequest, HttpServletResponse in Spring Security 4
body: <p>I've tried inject HttpRequest, HttpResponse.</p>
  
  <p>Tried </p>
  
  <pre><code>@Bean
  public RequestContextListener requestContextListener(){
     return new RequestContextListener();
  }
  
  @Controller("/test")
   public class Test {
      public String callback() {
          SecurityContextHolder.getContext().setAuthentication(auth);
          ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
          HttpServletRequest request = attributes.getRequest();
          HttpServletResponse response = attributes.getResponse();
      }
  }
  </code></pre>
  
  <p>Nothing, I always receive an empty object.</p>