private void doFilterHttp(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
throws IOException, ServletException {
try {
ManagerBuilder builder = ManagerBuilder.from().extension(Class.forName(DEFAULT_EXTENSION_CLASS));
Manager manager = builder.create();
manager.start();
manager.bind(ApplicationScoped.class, Manager.class, manager);
manager.fire(new BeforeSuite());
manager.fire(new BeforeRequest(request, response));
manager.bind(RequestScoped.class, ServletRequest.class, request);
manager.bind(RequestScoped.class, ServletResponse.class, response);
manager.bind(RequestScoped.class, HttpServletRequest.class, request);
manager.bind(RequestScoped.class, HttpServletResponse.class, response);
manager.bind(RequestScoped.class, FilterChain.class, filterChain);
try {
manager.fire(new ProcessHttpRequest());
} finally {
manager.fire(new AfterRequest(request, response));
manager.fire(new AfterSuite());
manager.shutdown();
}
} catch (ClassNotFoundException e) {
throw new IllegalStateException("Default service loader can't be found: " + DEFAULT_EXTENSION_CLASS, e);
}