use of org.atmosphere.runtime.AtmosphereResourceEventListenerAdapter.OnBroadcast in project atmosphere by Atmosphere.
the class AtmosphereResourceLifecycleInterceptor method postInspect.
@Override
public void postInspect(final AtmosphereResource r) {
if (r.transport().equals(UNDEFINED) || Utils.webSocketMessage(r) || r.transport().equals(POLLING))
return;
AtmosphereResourceImpl impl = AtmosphereResourceImpl.class.cast(r);
if ((force || impl.getRequest(false).getMethod().equalsIgnoreCase(method)) && !impl.action().equals(Action.CANCELLED) && impl.isInScope()) {
logger.trace("Marking AtmosphereResource {} for suspend operation", r.uuid());
r.addEventListener(new OnBroadcast() {
@Override
public void onBroadcast(AtmosphereResourceEvent event) {
switch(r.transport()) {
case JSONP:
case AJAX:
case LONG_POLLING:
break;
default:
try {
r.getResponse().flushBuffer();
} catch (IOException e) {
logger.trace("", e);
}
break;
}
}
}).suspend(timeoutInMilli);
}
}
Aggregations