org.atmosphere.cpr
Interface AtmosphereEvent<E,F>

All Known Implementing Classes:
AtmosphereEventImpl

public interface AtmosphereEvent<E,F>

A AtmosphereEvent encapsulates the mechanism to suspend(), resume() and broadcast (getBroadcaster()) messages among suspended response. AtmosphereEvent are passed at runtime to an instance of AtmosphereHandler.

Author:
Jeanfrancois Arcand

Method Summary
 AtmosphereServlet.AtmosphereConfig getAtmosphereConfig()
          Return the AtmosphereServlet.AtmosphereConfig
 Broadcaster getBroadcaster()
          Return the current Broadcaster
 Object getMessage()
          Return the object that were pass to Broadcaster.broadcast(java.lang.Object)
 E getRequest()
          Return the underlying Request.
 F getResponse()
          Return the underlying Response.
 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 resume() has been invoked
 boolean isSuspended()
          Return true if that suspend() has been invoked and set to true
 void resume()
          Complete the HttpServletResponse and finish/commit it.
 void setBroadcaster(Broadcaster broadcaster)
          Set the current Broadcaster
 void suspend()
          Suspend the HttpServletResponse indefinitely.
 void suspend(long timeout)
          Suspend the HttpServletResponse.
 

Method Detail

resume

void resume()
Complete the HttpServletResponse and finish/commit it. If the HttpServletResponse is in the process of being resumed, invoking that method has no effect.


isResumedOnTimeout

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


isCancelled

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


isSuspended

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

Returns:
true if that suspend() has been invoked and set to true

isResuming

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

Returns:
true if that resume() has been invoked and set to true

suspend

void suspend()
Suspend the HttpServletResponse indefinitely. Suspending a HttpServletResponse will tell the underlying container to avoid recycling objects associated with the current instance, and also to avoid commiting response.


suspend

void suspend(long timeout)
Suspend the HttpServletResponse. Suspending a HttpServletResponse will tell the underlying container to avoid recycling objects associated with the current instance, and also to avoid commiting response. Invoking this method when a request is being timed out, e.g. isResumedOnTimeout return true, has no effect.

Parameters:
timeout - The maximum amount of time, in milliseconds, a HttpServletResponse can be suspended. When the timeout expires (because nothing has been written or because the resume() or AtmosphereEvent#cancel()), the HttpServletResponse will be automatically resumed and commited. Usage of any methods of a HttpServletResponse that times out will throw an IllegalStateException.

getRequest

E getRequest()
Return the underlying Request.

Returns:
E the underlying Request.

getResponse

F getResponse()
Return the underlying Response.

Returns:
F the underlying Response.

getAtmosphereConfig

AtmosphereServlet.AtmosphereConfig getAtmosphereConfig()
Return the AtmosphereServlet.AtmosphereConfig

Returns:
the AtmosphereServlet.AtmosphereConfig

getBroadcaster

Broadcaster getBroadcaster()
Return the current Broadcaster


setBroadcaster

void setBroadcaster(Broadcaster broadcaster)
Set the current Broadcaster


getMessage

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

Returns:
the object that were pass to Broadcaster.broadcast(java.lang.Object)


Copyright © 2009 SUN Microsystems. All Rights Reserved.