@Inject
private Event<AfterRequest> afterRequest;
public void handleRequestContext(@Observes(precedence = 100) EventContext<ProcessHttpRequest> context) {
RequestContext testContext = this.requestContextInstance.get();
String requestId = String.valueOf(context.getEvent().getRequest().getAttribute(WarpCommons.WARP_REQUEST_ID));
try {
testContext.activate(requestId);
servletRequest.set(context.getEvent().getRequest());
servletResponse.set(context.getEvent().getResponse());
httpServletRequest.set(context.getEvent().getRequest());
httpServletResponse.set(context.getEvent().getResponse());
filterChain.set(context.getEvent().getFilterChain());
beforeRequest.fire(new BeforeRequest(context.getEvent().getRequest(), context.getEvent().getResponse()));
context.proceed();
} finally {
try {
afterRequest.fire(new AfterRequest(context.getEvent().getRequest(), context.getEvent().getResponse()));
} finally {
testContext.deactivate();
testContext.destroy(requestId);
}
}
}