org.atmosphere.websocket
Class WebSocketAtmosphereHandler
java.lang.Object
org.atmosphere.handler.AbstractReflectorAtmosphereHandler
org.atmosphere.websocket.WebSocketAtmosphereHandler
- All Implemented Interfaces:
- AtmosphereHandler<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
public class WebSocketAtmosphereHandler
- extends AbstractReflectorAtmosphereHandler
Simple AtmosphereHandler which redirect the first request to the web application welcome page.
Once the WebSocket upgrade happens, this class just invoke the upgrade(AtmosphereResource) method.
Application should override the upgrade(AtmosphereResource).
Application should override the AbstractReflectorAtmosphereHandler.onStateChange(org.atmosphere.cpr.AtmosphereResourceEvent) if they do not want to reflect/send back all Websocket messages to all connections.
- Author:
- Jeanfrancois Arcand
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WebSocketAtmosphereHandler
public WebSocketAtmosphereHandler()
onRequest
public void onRequest(AtmosphereResource<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse> r)
throws IOException
- This method redirect the request to the server main page (index.html, index.jsp, etc.) and then execute the
upgrade(AtmosphereResource).
- Parameters:
r - The AtmosphereResource
- Throws:
IOException
upgrade
public void upgrade(AtmosphereResource r)
throws IOException
- WebSocket upgrade. This is usually inside that method that you decide if a connection
needs to be suspended or not. Override this method for specific operations like configuring their own
Broadcaster, BroadcastFilter , BroadcasterCache etc.
- Parameters:
r - an AtmosphereResource
- Throws:
IOException
Copyright © 2011. All Rights Reserved.