org.atmosphere.cpr
Class AtmosphereResourceEventImpl

java.lang.Object
  extended by org.atmosphere.cpr.AtmosphereResourceEventImpl
All Implemented Interfaces:
AtmosphereResourceEvent<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>

public class AtmosphereResourceEventImpl
extends Object
implements AtmosphereResourceEvent<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>

AtmosphereResourceEvent implementation for Servlet Container.

Author:
Jeanfrancois Arcand

Field Summary
protected  boolean isResumedOnTimeout
           
protected  Object message
           
protected  AtmosphereResourceImpl r
           
 
Constructor Summary
AtmosphereResourceEventImpl(AtmosphereResourceImpl r)
           
AtmosphereResourceEventImpl(AtmosphereResourceImpl r, boolean isCancelled, boolean isResumedOnTimeout)
           
 
Method Summary
 Object getMessage()
          Return the object that were pass to Broadcaster.broadcast(java.lang.Object)
 AtmosphereResource<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse> getResource()
          Return the AtmosphereResource associated with this event
 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  void setCancelled(boolean isCancelled)
           
 void setMessage(Object message)
          Set the message broadcasted using Broadcaster.broadcast(java.lang.Object)
 void write(OutputStream os, Object o)
          Write the Object using the OutputStream by invoking the current Serializer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isResumedOnTimeout

protected boolean isResumedOnTimeout

message

protected Object message

r

protected final AtmosphereResourceImpl r
Constructor Detail

AtmosphereResourceEventImpl

public AtmosphereResourceEventImpl(AtmosphereResourceImpl r)

AtmosphereResourceEventImpl

public AtmosphereResourceEventImpl(AtmosphereResourceImpl r,
                                   boolean isCancelled,
                                   boolean isResumedOnTimeout)
Method Detail

isResuming

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

Specified by:
isResuming in interface AtmosphereResourceEvent<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
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<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
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<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
Returns:
the object that were pass to Broadcaster.broadcast(java.lang.Object)

setMessage

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

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<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>

isCancelled

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

Specified by:
isCancelled in interface AtmosphereResourceEvent<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>

setCancelled

protected void setCancelled(boolean isCancelled)

getResource

public AtmosphereResource<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse> getResource()
Return the AtmosphereResource associated with this event

Specified by:
getResource in interface AtmosphereResourceEvent<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
Returns:
AtmosphereResource

write

public void 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 {

Specified by:
write in interface AtmosphereResourceEvent<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
Parameters:
os - OutputStream
o - Object
Throws:
IOException


Copyright © 2010 SUN Microsystems. All Rights Reserved.