Package org.atmosphere.cpr
Class AtmosphereResourceEventImpl
- java.lang.Object
-
- org.atmosphere.cpr.AtmosphereResourceEventImpl
-
- All Implemented Interfaces:
AtmosphereResourceEvent
- Direct Known Subclasses:
HeartbeatAtmosphereResourceEvent
public class AtmosphereResourceEventImpl extends java.lang.Object implements AtmosphereResourceEvent
AtmosphereResourceEventimplementation.- Author:
- Jeanfrancois Arcand
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Objectmessageprotected AtmosphereResourceImplresource
-
Constructor Summary
Constructors Constructor Description AtmosphereResourceEventImpl(AtmosphereResourceImpl resource)AtmosphereResourceEventImpl(AtmosphereResourceImpl resource, boolean isCancelled, boolean isResumedOnTimeout)AtmosphereResourceEventImpl(AtmosphereResourceImpl resource, boolean isCancelled, boolean isResumedOnTimeout, boolean isClosedByClient, java.lang.Throwable throwable)AtmosphereResourceEventImpl(AtmosphereResourceImpl resource, boolean isCancelled, boolean isResumedOnTimeout, java.lang.Throwable throwable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Broadcasterbroadcaster()Return the broadcaster associated with theAtmosphereResourcethis object contains.AtmosphereResourceEventdestroy()booleanequals(java.lang.Object o)java.lang.ObjectgetMessage()Return the object that was passed toBroadcaster.broadcast(java.lang.Object).AtmosphereResourcegetResource()Return theAtmosphereResourceassociated with this event.inthashCode()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.AtmosphereResourceEventImplisClosedByClient(boolean isClosedByClient)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.AtmosphereResourceEventImplsetCancelled(boolean isCancelled)AtmosphereResourceEventImplsetCloseByApplication(boolean b)protected AtmosphereResourceEventImplsetIsResumedOnTimeout(boolean isResumedOnTimeout)AtmosphereResourceEventImplsetMessage(java.lang.Object message)Set an Object that can be retrieved withAtmosphereResourceEvent.getMessage().AtmosphereResourceEventsetThrowable(java.lang.Throwable t)java.lang.Throwablethrowable()Return aThrowableif an unexpected exception occured.java.lang.StringtoString()
-
-
-
Field Detail
-
message
protected java.lang.Object message
-
resource
protected AtmosphereResourceImpl resource
-
-
Constructor Detail
-
AtmosphereResourceEventImpl
public AtmosphereResourceEventImpl(AtmosphereResourceImpl resource)
-
AtmosphereResourceEventImpl
public AtmosphereResourceEventImpl(AtmosphereResourceImpl resource, boolean isCancelled, boolean isResumedOnTimeout)
-
AtmosphereResourceEventImpl
public AtmosphereResourceEventImpl(AtmosphereResourceImpl resource, boolean isCancelled, boolean isResumedOnTimeout, java.lang.Throwable throwable)
-
AtmosphereResourceEventImpl
public AtmosphereResourceEventImpl(AtmosphereResourceImpl resource, boolean isCancelled, boolean isResumedOnTimeout, boolean isClosedByClient, java.lang.Throwable throwable)
-
-
Method Detail
-
isResuming
public boolean isResuming()
Description copied from interface:AtmosphereResourceEventReturn true ifAtmosphereResource.resume()has been invoked.- Specified by:
isResumingin interfaceAtmosphereResourceEvent- Returns:
- true if
AtmosphereResource.resume()has been invoked and set to true
-
isSuspended
public boolean isSuspended()
Description copied from interface:AtmosphereResourceEventReturn true ifAtmosphereResource.suspend()has been invoked and set to true.- Specified by:
isSuspendedin interfaceAtmosphereResourceEvent- Returns:
- true if
AtmosphereResource.suspend()has been invoked and set to true
-
isClosedByClient
public boolean isClosedByClient()
Description copied from interface:AtmosphereResourceEventReturn 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).- Specified by:
isClosedByClientin interfaceAtmosphereResourceEvent- Returns:
-
isClosedByApplication
public boolean isClosedByApplication()
Description copied from interface:AtmosphereResourceEventReturn true if the application closed the connection usingAtmosphereResource.close().- Specified by:
isClosedByApplicationin interfaceAtmosphereResourceEvent- Returns:
- if the application.
-
setCloseByApplication
public AtmosphereResourceEventImpl setCloseByApplication(boolean b)
-
getMessage
public java.lang.Object getMessage()
Description copied from interface:AtmosphereResourceEventReturn the object that was passed toBroadcaster.broadcast(java.lang.Object).- Specified by:
getMessagein interfaceAtmosphereResourceEvent- Returns:
- the object that was passed to
Broadcaster.broadcast(java.lang.Object)
-
setMessage
public AtmosphereResourceEventImpl setMessage(java.lang.Object message)
Description copied from interface:AtmosphereResourceEventSet an Object that can be retrieved withAtmosphereResourceEvent.getMessage(). Note that the value may be overridden whenBroadcaster.broadcast(java.lang.Object)gets invoked.- Specified by:
setMessagein interfaceAtmosphereResourceEvent- Parameters:
message- an Object that can be retrieved withAtmosphereResourceEvent.getMessage().
-
isClosedByClient
public AtmosphereResourceEventImpl isClosedByClient(boolean isClosedByClient)
-
isResumedOnTimeout
public boolean isResumedOnTimeout()
Description copied from interface:AtmosphereResourceEventReturn true is the response gets resumed after a timeout.- Specified by:
isResumedOnTimeoutin interfaceAtmosphereResourceEvent- Returns:
- true is the response gets resumed after a timeout.
-
isCancelled
public boolean isCancelled()
Description copied from interface:AtmosphereResourceEventReturn true when the remote client close the connection.- Specified by:
isCancelledin interfaceAtmosphereResourceEvent- Returns:
- true when the remote client close the connection.
-
setCancelled
public AtmosphereResourceEventImpl setCancelled(boolean isCancelled)
-
setIsResumedOnTimeout
protected AtmosphereResourceEventImpl setIsResumedOnTimeout(boolean isResumedOnTimeout)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
throwable
public java.lang.Throwable throwable()
Description copied from interface:AtmosphereResourceEventReturn aThrowableif an unexpected exception occured.- Specified by:
throwablein interfaceAtmosphereResourceEvent- Returns:
Throwableif an unexpected exception occured.
-
broadcaster
public Broadcaster broadcaster()
Description copied from interface:AtmosphereResourceEventReturn the broadcaster associated with theAtmosphereResourcethis object contains.- Specified by:
broadcasterin interfaceAtmosphereResourceEvent
-
getResource
public AtmosphereResource getResource()
Description copied from interface:AtmosphereResourceEventReturn theAtmosphereResourceassociated with this event.- Specified by:
getResourcein interfaceAtmosphereResourceEvent- Returns:
AtmosphereResource
-
setThrowable
public AtmosphereResourceEvent setThrowable(java.lang.Throwable t)
-
destroy
public AtmosphereResourceEvent destroy()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-