org.atmosphere.gwt.server
Class AtmosphereGwtHandler

java.lang.Object
  extended by org.atmosphere.handler.AbstractReflectorAtmosphereHandler
      extended by org.atmosphere.gwt.server.AtmosphereGwtHandler
All Implemented Interfaces:
Executor, AtmosphereHandler, AtmosphereServletProcessor

public class AtmosphereGwtHandler
extends AbstractReflectorAtmosphereHandler
implements Executor, AtmosphereServletProcessor

Author:
p.havelaar

Field Summary
protected  com.google.gwt.user.server.rpc.SerializationPolicyProvider cometSerializationPolicyProvider
           
static String GWT_BROADCASTER_ID
           
protected  org.slf4j.Logger logger
           
static int NO_TIMEOUT
           
 
Constructor Summary
AtmosphereGwtHandler()
           
 
Method Summary
 void broadcast(List<Serializable> messages, GwtAtmosphereResource resource)
           
 void broadcast(Serializable message, GwtAtmosphereResource resource)
           
 void cometTerminated(GwtAtmosphereResource cometResponse, boolean serverInitiated)
           
protected  int computeHeartbeat(int requestedHeartbeat)
           
protected  Serializable deserialize(char[] data, SerialMode mode)
           
protected  Serializable deserialize(String data, SerialMode mode)
           
 void destroy()
           
 void disconnect(GwtAtmosphereResource resource)
           
 int doComet(GwtAtmosphereResource resource)
           
 void doPost(javax.servlet.http.HttpServletRequest postRequest, javax.servlet.http.HttpServletResponse postResponse, List<Serializable> messages, GwtAtmosphereResource cometResource)
          Default implementation echo's the message back to the client
protected  void doServerMessage(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, int connectionID)
           
 void execute(Runnable command)
          Execute a task in a seperate thread, the thread pool will grow and shrink depending on demand
protected  Broadcaster getBroadcaster(GwtAtmosphereResource resource)
          Deprecated. 
 int getHeartbeat()
           
 javax.servlet.ServletContext getServletContext()
           
 void init(javax.servlet.ServletConfig servletConfig)
           
protected  GwtAtmosphereResource lookupResource(int connectionId)
          This can be used to lookup a resource for instance if you are implementing a remote service call You will need to pass the connectionID, which you can pass as an url parameter {getConnectionID()} or directly in your remote call
 void onRequest(AtmosphereResource resource)
           
 void post(javax.servlet.http.HttpServletRequest postRequest, javax.servlet.http.HttpServletResponse postResponse, List<Serializable> messages, GwtAtmosphereResource cometResource)
           
protected  void reapResources()
           
 void setHeartbeat(int heartbeat)
           
 String toString()
           
 
Methods inherited from class org.atmosphere.handler.AbstractReflectorAtmosphereHandler
onStateChange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.atmosphere.cpr.AtmosphereHandler
onStateChange
 

Field Detail

NO_TIMEOUT

public static final int NO_TIMEOUT
See Also:
Constant Field Values

GWT_BROADCASTER_ID

public static final String GWT_BROADCASTER_ID
See Also:
Constant Field Values

logger

protected final org.slf4j.Logger logger

cometSerializationPolicyProvider

protected com.google.gwt.user.server.rpc.SerializationPolicyProvider cometSerializationPolicyProvider
Constructor Detail

AtmosphereGwtHandler

public AtmosphereGwtHandler()
Method Detail

doComet

public int doComet(GwtAtmosphereResource resource)
            throws javax.servlet.ServletException,
                   IOException
Throws:
javax.servlet.ServletException
IOException

cometTerminated

public void cometTerminated(GwtAtmosphereResource cometResponse,
                            boolean serverInitiated)

doPost

public void doPost(javax.servlet.http.HttpServletRequest postRequest,
                   javax.servlet.http.HttpServletResponse postResponse,
                   List<Serializable> messages,
                   GwtAtmosphereResource cometResource)
Default implementation echo's the message back to the client

Parameters:
messages -
cometResource -

getBroadcaster

@Deprecated
protected Broadcaster getBroadcaster(GwtAtmosphereResource resource)
Deprecated. 


lookupResource

protected GwtAtmosphereResource lookupResource(int connectionId)
This can be used to lookup a resource for instance if you are implementing a remote service call You will need to pass the connectionID, which you can pass as an url parameter {getConnectionID()} or directly in your remote call

Parameters:
connectionId -
Returns:

init

public void init(javax.servlet.ServletConfig servletConfig)
          throws javax.servlet.ServletException
Specified by:
init in interface AtmosphereServletProcessor
Throws:
javax.servlet.ServletException

destroy

public void destroy()
Specified by:
destroy in interface AtmosphereHandler

getHeartbeat

public int getHeartbeat()

setHeartbeat

public void setHeartbeat(int heartbeat)

getServletContext

public javax.servlet.ServletContext getServletContext()

reapResources

protected void reapResources()

onRequest

public void onRequest(AtmosphereResource resource)
               throws IOException
Specified by:
onRequest in interface AtmosphereHandler
Throws:
IOException

doServerMessage

protected void doServerMessage(javax.servlet.http.HttpServletRequest request,
                               javax.servlet.http.HttpServletResponse response,
                               int connectionID)
                        throws IOException
Throws:
IOException

deserialize

protected Serializable deserialize(char[] data,
                                   SerialMode mode)

deserialize

protected Serializable deserialize(String data,
                                   SerialMode mode)

post

public final void post(javax.servlet.http.HttpServletRequest postRequest,
                       javax.servlet.http.HttpServletResponse postResponse,
                       List<Serializable> messages,
                       GwtAtmosphereResource cometResource)

broadcast

public void broadcast(Serializable message,
                      GwtAtmosphereResource resource)

broadcast

public void broadcast(List<Serializable> messages,
                      GwtAtmosphereResource resource)

disconnect

public void disconnect(GwtAtmosphereResource resource)

execute

public void execute(Runnable command)
Execute a task in a seperate thread, the thread pool will grow and shrink depending on demand

Specified by:
execute in interface Executor
Parameters:
command -

computeHeartbeat

protected int computeHeartbeat(int requestedHeartbeat)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012. All Rights Reserved.