org.atmosphere.samples.counter
Class CounterLongPollingAtmosphereHandler

java.lang.Object
  extended by org.atmosphere.samples.counter.CounterLongPollingAtmosphereHandler
All Implemented Interfaces:
AtmosphereHandler<HttpServletRequest,HttpServletResponse>

public class CounterLongPollingAtmosphereHandler
extends Object
implements AtmosphereHandler<HttpServletRequest,HttpServletResponse>

Simple application that demonstrate how a Comet long poll request can be implemented. Mainly, the client send a GET, the AtmosphereHandler suspend the connection. As soon a POST request arrive, the underlying response is resumed.

Author:
jeanfrancoisarcand

Constructor Summary
CounterLongPollingAtmosphereHandler()
           
 
Method Summary
 AtmosphereEvent onEvent(AtmosphereEvent<HttpServletRequest,HttpServletResponse> event)
          On GET, suspend the conneciton.
 AtmosphereEvent onMessage(AtmosphereEvent<HttpServletRequest,HttpServletResponse> event)
          Resume the underlying response on the first Broadcast
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CounterLongPollingAtmosphereHandler

public CounterLongPollingAtmosphereHandler()
Method Detail

onEvent

public AtmosphereEvent onEvent(AtmosphereEvent<HttpServletRequest,HttpServletResponse> event)
                        throws IOException
On GET, suspend the conneciton. On POST, resume the connection.

Specified by:
onEvent in interface AtmosphereHandler<HttpServletRequest,HttpServletResponse>
Parameters:
event -
Returns:
Throws:
IOException

onMessage

public AtmosphereEvent onMessage(AtmosphereEvent<HttpServletRequest,HttpServletResponse> event)
                          throws IOException
Resume the underlying response on the first Broadcast

Specified by:
onMessage in interface AtmosphereHandler<HttpServletRequest,HttpServletResponse>
Parameters:
event -
Returns:
Throws:
IOException


Copyright © 2009 SUN Microsystems. All Rights Reserved.