com.glines.socketio.server.transport
Class XHRTransport.XHRSessionHelper

java.lang.Object
  extended by com.glines.socketio.server.transport.XHRTransport.XHRSessionHelper
All Implemented Interfaces:
SocketIOOutbound, SocketIOSession.SessionTransportHandler, EventListener, org.eclipse.jetty.continuation.ContinuationListener
Direct Known Subclasses:
JSONPPollingTransport.XHRPollingSessionHelper, XHRPollingTransport.XHRPollingSessionHelper
Enclosing class:
XHRTransport

protected abstract class XHRTransport.XHRSessionHelper
extends Object
implements SocketIOSession.SessionTransportHandler, org.eclipse.jetty.continuation.ContinuationListener


Field Summary
protected  SocketIOSession session
           
 
Method Summary
 void abort()
          Cause connection and all activity to be aborted and all resources to be released.
 void close()
          Initiate an orderly close of the connection.
 void connect(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
protected abstract  void customConnect(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
protected  String decodePostData(String contentType, String data)
           
 void disconnect()
          Terminate the connection.
 void disconnectWhenEmpty()
           
protected abstract  void finishSend(javax.servlet.ServletResponse response)
           
 ConnectionState getConnectionState()
           
 void handle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, SocketIOSession session)
           
 void onComplete(org.eclipse.jetty.continuation.Continuation cont)
           
 void onTimeout(org.eclipse.jetty.continuation.Continuation cont)
           
 void sendMessage(int messageType, String message)
          Send a message.
 void sendMessage(SocketIOFrame frame)
           
 void sendMessage(String message)
          Send a message to the client.
protected abstract  void startSend(javax.servlet.http.HttpServletResponse response)
           
protected abstract  void writeData(javax.servlet.ServletResponse response, String data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

session

protected final SocketIOSession session
Method Detail

startSend

protected abstract void startSend(javax.servlet.http.HttpServletResponse response)
                           throws IOException
Throws:
IOException

writeData

protected abstract void writeData(javax.servlet.ServletResponse response,
                                  String data)
                           throws IOException
Throws:
IOException

finishSend

protected abstract void finishSend(javax.servlet.ServletResponse response)
                            throws IOException
Throws:
IOException

disconnect

public void disconnect()
Description copied from interface: SocketIOOutbound
Terminate the connection. This method may return before the connection disconnect completes. The onDisconnect() method of the associated SocketInbound will be called when the disconnect is completed. The onDisconnect() method may be called during the invocation of this method.

Specified by:
disconnect in interface SocketIOOutbound

close

public void close()
Description copied from interface: SocketIOOutbound
Initiate an orderly close of the connection. The state will be changed to CLOSING so no new messages can be sent, but messages may still arrive until the distant end has acknowledged the close.

Specified by:
close in interface SocketIOOutbound

getConnectionState

public ConnectionState getConnectionState()
Specified by:
getConnectionState in interface SocketIOOutbound

sendMessage

public void sendMessage(SocketIOFrame frame)
                 throws SocketIOException
Specified by:
sendMessage in interface SocketIOSession.SessionTransportHandler
Throws:
SocketIOException

sendMessage

public void sendMessage(String message)
                 throws SocketIOException
Description copied from interface: SocketIOOutbound
Send a message to the client. This method will block if the message will not fit in the outbound buffer. If the socket is closed, becomes closed, or times out, while trying to send the message, the SocketClosedException will be thrown.

Specified by:
sendMessage in interface SocketIOOutbound
Parameters:
message - The message to send
Throws:
SocketIOException

sendMessage

public void sendMessage(int messageType,
                        String message)
                 throws SocketIOException
Description copied from interface: SocketIOOutbound
Send a message.

Specified by:
sendMessage in interface SocketIOOutbound
Throws:
SocketIOException

handle

public void handle(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response,
                   SocketIOSession session)
            throws IOException
Specified by:
handle in interface SocketIOSession.SessionTransportHandler
Throws:
IOException

decodePostData

protected String decodePostData(String contentType,
                                String data)

onComplete

public void onComplete(org.eclipse.jetty.continuation.Continuation cont)
Specified by:
onComplete in interface org.eclipse.jetty.continuation.ContinuationListener

onTimeout

public void onTimeout(org.eclipse.jetty.continuation.Continuation cont)
Specified by:
onTimeout in interface org.eclipse.jetty.continuation.ContinuationListener

customConnect

protected abstract void customConnect(javax.servlet.http.HttpServletRequest request,
                                      javax.servlet.http.HttpServletResponse response)
                               throws IOException
Throws:
IOException

connect

public void connect(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
             throws IOException
Throws:
IOException

disconnectWhenEmpty

public void disconnectWhenEmpty()
Specified by:
disconnectWhenEmpty in interface SocketIOSession.SessionTransportHandler

abort

public void abort()
Description copied from interface: SocketIOSession.SessionTransportHandler
Cause connection and all activity to be aborted and all resources to be released. The handler is expected to call the session's onShutdown() when it is finished. The only session method that the handler can legally call after this is onShutdown();

Specified by:
abort in interface SocketIOSession.SessionTransportHandler


Copyright © 2010-2011. All Rights Reserved.