org.atmosphere.handler
Class SimpleWebSocketAtmosphereHandler

java.lang.Object
  extended by org.atmosphere.handler.AbstractReflectorAtmosphereHandler
      extended by org.atmosphere.handler.SimpleWebSocketAtmosphereHandler
All Implemented Interfaces:
AtmosphereHandler<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>

public class SimpleWebSocketAtmosphereHandler
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

Constructor Summary
SimpleWebSocketAtmosphereHandler()
           
 
Method Summary
 void destroy()
          Destroy this handler
 void onRequest(AtmosphereResource<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse> r)
          This method redirect the request to the server main page (index.html, index.jsp, etc.) and then execute the upgrade(AtmosphereResource).
 void upgrade(AtmosphereResource<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse> resource)
          WebSocket upgrade.
 
Methods inherited from class org.atmosphere.handler.AbstractReflectorAtmosphereHandler
onStateChange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleWebSocketAtmosphereHandler

public SimpleWebSocketAtmosphereHandler()
Method Detail

onRequest

public final 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<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse> resource)
             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:
resource - an AtmosphereResource
Throws:
IOException

destroy

public void destroy()
Description copied from interface: AtmosphereHandler
Destroy this handler



Copyright © 2012. All Rights Reserved.