com.vaadin.server.communication
Class AtmospherePushConnection

java.lang.Object
  extended by com.vaadin.server.communication.AtmospherePushConnection
All Implemented Interfaces:
PushConnection

public class AtmospherePushConnection
extends java.lang.Object
implements PushConnection

PushConnection implementation using the Atmosphere push support that is by default included in Vaadin.

Since:
7.1
Author:
Vaadin Ltd

Nested Class Summary
protected static class AtmospherePushConnection.FragmentedMessage
          Represents a message that can arrive as multiple fragments.
 
Constructor Summary
AtmospherePushConnection(UI ui, org.atmosphere.cpr.AtmosphereResource resource)
           
 
Method Summary
 void disconnect()
          Closes the connection.
protected  org.atmosphere.cpr.AtmosphereResource getResource()
           
protected  UI getUI()
           
 boolean isConnected()
          Returns whether this connection is currently open.
 void push()
          Pushes pending state changes and client RPC calls to the client.
protected  void push(boolean async)
          Pushes pending state changes and client RPC calls to the client.
protected  java.io.Reader receiveMessage(java.io.Reader reader)
          Reads and buffers a (possibly partial) message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AtmospherePushConnection

public AtmospherePushConnection(UI ui,
                                org.atmosphere.cpr.AtmosphereResource resource)
Method Detail

push

public void push()
Description copied from interface: PushConnection
Pushes pending state changes and client RPC calls to the client. Cannot be called if PushConnection.isConnected() is false. It is NOT safe to invoke this method if not holding the session lock.

This is internal API; please use UI.push() instead.

Specified by:
push in interface PushConnection

push

protected void push(boolean async)
             throws java.io.IOException
Pushes pending state changes and client RPC calls to the client.

Parameters:
async - True if this push asynchronously originates from the server, false if it is a response to a client request.
Throws:
java.io.IOException

receiveMessage

protected java.io.Reader receiveMessage(java.io.Reader reader)
                                 throws java.io.IOException
Reads and buffers a (possibly partial) message. If a complete message was received, or if the call resulted in the completion of a partially received message, returns a Reader yielding the complete message. Otherwise, returns null.

Parameters:
reader - A Reader from which to read the (partial) message
Returns:
A Reader yielding a complete message or null if the message is not yet complete.
Throws:
java.io.IOException

isConnected

public boolean isConnected()
Description copied from interface: PushConnection
Returns whether this connection is currently open.

Specified by:
isConnected in interface PushConnection

getUI

protected UI getUI()
Returns:
the UI associated with this connection.

getResource

protected org.atmosphere.cpr.AtmosphereResource getResource()
Returns:
The AtmosphereResource associated with this connection or null if connection not open.

disconnect

public void disconnect()
Description copied from interface: PushConnection
Closes the connection. Cannot be called if PushConnection.isConnected() is false.

Specified by:
disconnect in interface PushConnection


Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.