Package org.atmosphere.cpr
Interface AtmosphereResourceEvent
-
- All Known Implementing Classes:
AtmosphereResourceEventImpl,HeartbeatAtmosphereResourceEvent
public interface AtmosphereResourceEventAn AtmosphereResourceEvent is created every time an event occurs, like when aBroadcaster.broadcast(java.lang.Object)is executed, when a browser remotely closes the connection or when a suspended resource times out or gets resumed. When such events occur, an instance of that class will be created and its associatedAtmosphereHandler.onStateChange(org.atmosphere.cpr.AtmosphereResourceEvent)will be invoked.- Author:
- Jeanfrancois Arcand
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Broadcasterbroadcaster()Return the broadcaster associated with theAtmosphereResourcethis object contains.java.lang.ObjectgetMessage()Return the object that was passed toBroadcaster.broadcast(java.lang.Object).AtmosphereResourcegetResource()Return theAtmosphereResourceassociated with this event.booleanisCancelled()Return true when the remote client close the connection.booleanisClosedByApplication()Return true if the application closed the connection usingAtmosphereResource.close().booleanisClosedByClient()Return true if the client closed the connection and send the Atmosphere close message.booleanisResumedOnTimeout()Return true is the response gets resumed after a timeout.booleanisResuming()Return true ifAtmosphereResource.resume()has been invoked.booleanisSuspended()Return true ifAtmosphereResource.suspend()has been invoked and set to true.AtmosphereResourceEventsetMessage(java.lang.Object o)Set an Object that can be retrieved withgetMessage().java.lang.Throwablethrowable()Return aThrowableif an unexpected exception occured.
-
-
-
Method Detail
-
getMessage
java.lang.Object getMessage()
Return the object that was passed toBroadcaster.broadcast(java.lang.Object).- Returns:
- the object that was passed to
Broadcaster.broadcast(java.lang.Object)
-
setMessage
AtmosphereResourceEvent setMessage(java.lang.Object o)
Set an Object that can be retrieved withgetMessage(). Note that the value may be overridden whenBroadcaster.broadcast(java.lang.Object)gets invoked.- Parameters:
o- an Object that can be retrieved withgetMessage().
-
isResumedOnTimeout
boolean isResumedOnTimeout()
Return true is the response gets resumed after a timeout.- Returns:
- true is the response gets resumed after a timeout.
-
isCancelled
boolean isCancelled()
Return true when the remote client close the connection.- Returns:
- true when the remote client close the connection.
-
isSuspended
boolean isSuspended()
Return true ifAtmosphereResource.suspend()has been invoked and set to true.- Returns:
- true if
AtmosphereResource.suspend()has been invoked and set to true
-
isResuming
boolean isResuming()
Return true ifAtmosphereResource.resume()has been invoked.- Returns:
- true if
AtmosphereResource.resume()has been invoked and set to true
-
getResource
AtmosphereResource getResource()
Return theAtmosphereResourceassociated with this event.- Returns:
AtmosphereResource
-
isClosedByClient
boolean isClosedByClient()
Return true if the client closed the connection and send the Atmosphere close message. You must use theOnDisconnectInterceptorin order to receive the proper value, and atmosphereProtocol must be set to true on the client side (enabledProtocol is true by default).- Returns:
-
isClosedByApplication
boolean isClosedByApplication()
Return true if the application closed the connection usingAtmosphereResource.close().- Returns:
- if the application.
-
throwable
java.lang.Throwable throwable()
Return aThrowableif an unexpected exception occured.- Returns:
Throwableif an unexpected exception occured.
-
broadcaster
Broadcaster broadcaster()
Return the broadcaster associated with theAtmosphereResourcethis object contains.
-
-