if (logger.isTraceEnabled()) {
logger.trace("Event Type {} for {}", event.getType(), req.getRequestURL().toString());
}
Action action = null;
// For now, we are just interested in HttpEvent.REA
AtmosphereResource r = req.resource();
if (event.getType() == HttpEvent.EventType.BEGIN) {
action = suspended(req, res);
if (action.type() == Action.TYPE.SUSPEND) {
// Do nothing except setting the times out
try {
if (action.timeout() != -1) {
event.setTimeout((int) action.timeout());
} else {
event.setTimeout(Integer.MAX_VALUE);
}
req.setAttribute(SUSPENDED, true);
} catch (UnsupportedOperationException ex) {
// Swallow s Tomcat APR isn't supporting time out
// TODO: Must implement the same functionality using a Scheduler
}
} else if (action.type() == Action.TYPE.RESUME) {
event.close();
} else {
event.close();
}
} else if (event.getType() == HttpEvent.EventType.READ) {