org.atmosphere.samples.chat
Class AppEngineAtmosphereHandler
java.lang.Object
org.atmosphere.samples.chat.AppEngineAtmosphereHandler
- All Implemented Interfaces:
- AtmosphereHandler<HttpServletRequest,HttpServletResponse>
public class AppEngineAtmosphereHandler
- extends Object
- implements AtmosphereHandler<HttpServletRequest,HttpServletResponse>
Simple AtmosphereHandler that implement the logic to build a Chat application.
- Author:
- Jeanfrancois Arcand
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AppEngineAtmosphereHandler
public AppEngineAtmosphereHandler()
onRequest
public void onRequest(AtmosphereResource<HttpServletRequest,HttpServletResponse> event)
throws IOException
- When the
AtmosphereServlet detect an HttpServletRequest
maps to this AtmosphereHandler, the AtmosphereHandler.onRequest(org.atmosphere.cpr.AtmosphereResource)
gets invoked and the response will be suspended depending on the http
method, e.g. GET will suspend the connection, POST will broadcast chat
message to suspended connection.
- Specified by:
onRequest in interface AtmosphereHandler<HttpServletRequest,HttpServletResponse>
- Parameters:
event - An AtmosphereResource
- Throws:
IOException
onStateChange
public void onStateChange(AtmosphereResourceEvent<HttpServletRequest,HttpServletResponse> event)
throws IOException
- Invoked when a call to
Broadcaster.broadcast(java.lang.Object) is
issued or when the response times out, e.g whne the value AtmosphereResource.suspend(long)
expires.
- Specified by:
onStateChange in interface AtmosphereHandler<HttpServletRequest,HttpServletResponse>
- Parameters:
event - An AtmosphereResourceEvent
- Throws:
IOException
Copyright © 2010 SUN Microsystems. All Rights Reserved.