org.atmosphere.cpr
Class AtmosphereResourceEventImpl

java.lang.Object
  extended by org.atmosphere.cpr.AtmosphereResourceEventImpl
All Implemented Interfaces:
AtmosphereResourceEvent

public class AtmosphereResourceEventImpl
extends Object
implements AtmosphereResourceEvent

AtmosphereResourceEvent implementation for Servlet Container.

Author:
Jeanfrancois Arcand

Field Summary
protected  Object message
           
protected  AtmosphereResourceImpl resource
           
 
Constructor Summary
AtmosphereResourceEventImpl(AtmosphereResourceImpl resource)
           
AtmosphereResourceEventImpl(AtmosphereResourceImpl resource, boolean isCancelled, boolean isResumedOnTimeout)
           
AtmosphereResourceEventImpl(AtmosphereResourceImpl resource, boolean isCancelled, boolean isResumedOnTimeout, Throwable throwable)
           
 
Method Summary
 Broadcaster broadcaster()
          Return the broadcaster associated with the AtmosphereResource this object contains.
 AtmosphereResourceEvent destroy()
           
 boolean equals(Object o)
           
 Object getMessage()
          Return the object that were pass to Broadcaster.broadcast(java.lang.Object)
 AtmosphereResource getResource()
          Return the AtmosphereResource associated with this event
 int hashCode()
           
 boolean isCancelled()
          Return true when the remote client close the connection.
 boolean isResumedOnTimeout()
          Return true is the response gets resumed after a timeout.
 boolean isResuming()
          Return true if that AtmosphereResource.resume() has been invoked
 boolean isSuspended()
          Return true if that AtmosphereResource.suspend() has been invoked and set to true
protected  AtmosphereResourceEvent setCancelled(boolean isCancelled)
           
protected  AtmosphereResourceEvent setIsResumedOnTimeout(boolean isResumedOnTimeout)
           
 AtmosphereResourceEvent setMessage(Object message)
          Set the message broadcasted using Broadcaster.broadcast(java.lang.Object)
 AtmosphereResourceEvent setThrowable(Throwable t)
           
 Throwable throwable()
          Return a Throwable if an unexpected exception occured.
 String toString()
           
 AtmosphereResourceEvent write(byte[] o)
          Write the byte using the underlying AtmosphereResponse.getOutputStream()
 AtmosphereResourceEvent write(OutputStream os, Object o)
          Write the Object using the OutputStream by invoking the current Serializer.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

message

protected 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,
                                   Throwable throwable)
Method Detail

isResuming

public boolean isResuming()
Return true if that AtmosphereResource.resume() has been invoked

Specified by:
isResuming in interface AtmosphereResourceEvent
Returns:
true if that AtmosphereResource.resume() has been invoked and set to true

isSuspended

public boolean isSuspended()
Return true if that AtmosphereResource.suspend() has been invoked and set to true

Specified by:
isSuspended in interface AtmosphereResourceEvent
Returns:
true if that AtmosphereResource.suspend() has been invoked and set to true

getMessage

public Object getMessage()
Return the object that were pass to Broadcaster.broadcast(java.lang.Object)

Specified by:
getMessage in interface AtmosphereResourceEvent
Returns:
the object that were pass to Broadcaster.broadcast(java.lang.Object)

setMessage

public AtmosphereResourceEvent setMessage(Object message)
Set the message broadcasted using Broadcaster.broadcast(java.lang.Object)

Specified by:
setMessage in interface AtmosphereResourceEvent
Parameters:
message - The message broadcasted using Broadcaster.broadcast(java.lang.Object)

isResumedOnTimeout

public boolean isResumedOnTimeout()
Return true is the response gets resumed after a timeout.

Specified by:
isResumedOnTimeout in interface AtmosphereResourceEvent
Returns:
true is the response gets resumed after a timeout.

isCancelled

public boolean isCancelled()
Return true when the remote client close the connection.

Specified by:
isCancelled in interface AtmosphereResourceEvent
Returns:
true when the remote client close the connection.

setCancelled

protected AtmosphereResourceEvent setCancelled(boolean isCancelled)

setIsResumedOnTimeout

protected AtmosphereResourceEvent setIsResumedOnTimeout(boolean isResumedOnTimeout)

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

throwable

public Throwable throwable()
Return a Throwable if an unexpected exception occured.

Specified by:
throwable in interface AtmosphereResourceEvent
Returns:
Throwable if an unexpected exception occured.

write

public AtmosphereResourceEvent write(byte[] o)
                              throws IOException
Write the byte using the underlying AtmosphereResponse.getOutputStream()

Specified by:
write in interface AtmosphereResourceEvent
Parameters:
o - byte
Throws:
IOException

broadcaster

public Broadcaster broadcaster()
Return the broadcaster associated with the AtmosphereResource this object contains.

Specified by:
broadcaster in interface AtmosphereResourceEvent

getResource

public AtmosphereResource getResource()
Return the AtmosphereResource associated with this event

Specified by:
getResource in interface AtmosphereResourceEvent
Returns:
AtmosphereResource

write

public AtmosphereResourceEvent write(OutputStream os,
                                     Object o)
                              throws IOException
Write the Object using the OutputStream by invoking the current Serializer. If Serializer is null, the Object will be directly written using the AtmosphereResponse.getOutputStream()

Specified by:
write in interface AtmosphereResourceEvent
Parameters:
os - OutputStream
o - Object
Throws:
IOException

setThrowable

public AtmosphereResourceEvent setThrowable(Throwable t)

destroy

public AtmosphereResourceEvent destroy()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.