AsyncListener asyncListener = asyncListenerRegistration.getListener();
try {
if (timeout) {
AsyncEvent asyncEvent = new AsyncEvent(asyncContext,
asyncListenerRegistration.getRequest(), asyncListenerRegistration.getResponse());
asyncListener.onTimeout(asyncEvent);
} else if (error) {
Throwable t = (Throwable) request.getAttribute(Globals.EXCEPTION_ATTR);
AsyncEvent asyncEvent = new AsyncEvent(asyncContext,
asyncListenerRegistration.getRequest(), asyncListenerRegistration.getResponse(), t);
asyncListener.onError(asyncEvent);