org.atmosphere.samples.counter
Class CounterLongPollingAtmosphereHandler
java.lang.Object
org.atmosphere.samples.counter.CounterLongPollingAtmosphereHandler
- All Implemented Interfaces:
- AtmosphereHandler<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
public class CounterLongPollingAtmosphereHandler
- extends Object
- implements AtmosphereHandler<javax.servlet.http.HttpServletRequest,javax.servlet.http.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:
- Jeanfrancois Arcand
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CounterLongPollingAtmosphereHandler
public CounterLongPollingAtmosphereHandler()
onRequest
public void onRequest(AtmosphereResource<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse> resource)
throws IOException
- On GET, suspend the connection. On POST, resume the connection.
- Specified by:
onRequest in interface AtmosphereHandler<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
- Parameters:
resource -
- Throws:
IOException
onStateChange
public void onStateChange(AtmosphereResourceEvent<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse> event)
throws IOException
- Resume the underlying response on the first
Broadcaster
- Specified by:
onStateChange in interface AtmosphereHandler<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
- Parameters:
event -
- Throws:
IOException
destroy
public void destroy()
- Specified by:
destroy in interface AtmosphereHandler<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
Copyright © 2012. All Rights Reserved.