com.vaadin.server
Class AbstractCommunicationManager

java.lang.Object
  extended by com.vaadin.server.AbstractCommunicationManager
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CommunicationManager, PortletCommunicationManager

Deprecated. might be refactored or removed before 7.0.0

@Deprecated
public abstract class AbstractCommunicationManager
extends java.lang.Object
implements java.io.Serializable

This is a common base class for the server-side implementations of the communication system between the client code (compiled with GWT into JavaScript) and the server side components. Its client side counterpart is com.vaadin.client.ApplicationConnection.

TODO Document better!

See Also:
Serialized Form

Nested Class Summary
static interface AbstractCommunicationManager.Callback
          Deprecated. might be refactored or removed before 7.0.0
 class AbstractCommunicationManager.ErrorHandlerErrorEvent
          Deprecated.  
protected  class AbstractCommunicationManager.InvalidUIDLSecurityKeyException
          Deprecated.  
static class AbstractCommunicationManager.SimpleMultiPartInputStream
          Deprecated. Stream that extracts content from another stream until the boundary string is encountered.
 
Field Summary
static char VAR_BURST_SEPARATOR
          Deprecated.  
static char VAR_ESCAPE_CHARACTER
          Deprecated.  
 
Constructor Summary
AbstractCommunicationManager(VaadinSession session)
          Deprecated. TODO New constructor - document me!
 
Method Summary
protected  void changeVariables(java.lang.Object source, VariableOwner owner, java.util.Map<java.lang.String,java.lang.Object> m)
          Deprecated.  
 void cleanStreamVariable(ClientConnector owner, java.lang.String name)
          Deprecated.  
protected  void closeJsonMessage(java.io.PrintWriter outWriter)
          Deprecated.  
protected abstract  BootstrapHandler createBootstrapHandler()
          Deprecated. might be refactored or removed before 7.0.0
protected  void doHandleSimpleMultipartFileUpload(WrappedRequest request, WrappedResponse response, StreamVariable streamVariable, java.lang.String variableName, ClientConnector owner, java.lang.String boundary)
          Deprecated. Method used to stream content from a multipart request (either from servlet or portlet request) to given StreamVariable
protected  void doHandleXhrFilePost(WrappedRequest request, WrappedResponse response, StreamVariable streamVariable, java.lang.String variableName, ClientConnector owner, int contentLength)
          Deprecated. Used to stream plain file post (aka XHR2.post(File))
static org.json.JSONObject encodeState(ClientConnector connector, com.vaadin.shared.communication.SharedState state)
          Deprecated.  
protected  ClientConnector getConnector(UI uI, java.lang.String connectorId)
          Deprecated.  
protected  java.lang.String getInitialUIDL(WrappedRequest request, UI uI)
          Deprecated. Generates the initial UIDL message that can e.g.
protected  java.lang.String getRequestPayload(WrappedRequest request)
          Deprecated. Reads the request data from the Request and returns it converted to an UTF-8 string.
protected  java.lang.String getSecurityKey(WrappedRequest request)
          Deprecated. Gets the security key (and generates one if needed).
 java.lang.String getSecurityKeyUIDL(WrappedRequest request)
          Deprecated. Gets the security key (and generates one if needed) as UIDL.
 StreamVariable getStreamVariable(java.lang.String connectorId, java.lang.String variableName)
          Deprecated.  
 java.lang.String getStreamVariableTargetUrl(ClientConnector owner, java.lang.String name, StreamVariable value)
          Deprecated.  
protected abstract  java.io.InputStream getThemeResourceAsStream(UI uI, java.lang.String themeName, java.lang.String resource)
          Deprecated.  
protected  VaadinSession getVaadinSession()
          Deprecated.  
protected  boolean handleApplicationRequest(WrappedRequest request, WrappedResponse response)
          Deprecated. Handles a request by passing it to each registered RequestHandler in turn until one produces a response.
 void handleBrowserDetailsRequest(WrappedRequest request, WrappedResponse response, VaadinSession session)
          Deprecated.  
 boolean handleBurst(WrappedRequest source, UI uI, java.lang.String burst)
          Deprecated. Processes a message burst received from the client.
 void handleFileUpload(VaadinSession session, WrappedRequest request, WrappedResponse response)
          Deprecated. Handles file upload request submitted via Upload component.
 void handleHeartbeatRequest(WrappedRequest request, WrappedResponse response, VaadinSession session)
          Deprecated. Handles a heartbeat request.
 void handleUidlRequest(WrappedRequest request, WrappedResponse response, AbstractCommunicationManager.Callback callback, UI uI)
          Deprecated. Internally process a UIDL request from the client.
protected  void highlightConnector(com.vaadin.shared.Connector highlightedConnector)
          Deprecated.  
static boolean isVisible(ClientConnector connector)
          Deprecated. Checks if the connector is visible in context.
 boolean isXSRFEnabled(VaadinSession session)
          Deprecated. Returns false if the cross site request forgery protection is turned off.
protected  void openJsonMessage(java.io.PrintWriter outWriter, WrappedResponse response)
          Deprecated. Writes the opening of JSON message to be sent to client.
protected  void postPaint(UI uI)
          Deprecated. Method called after the paint phase while still being synchronized on the session
protected  void printHighlightedComponentHierarchy(java.lang.StringBuilder sb, AbstractComponent component)
          Deprecated.  
 void requireLocale(java.lang.String value)
          Deprecated. Queues a locale to be sent to the client (browser) for date and time entry etc.
protected  void sendUploadResponse(WrappedRequest request, WrappedResponse response)
          Deprecated. TODO document
 void serveConnectorResource(WrappedRequest request, WrappedResponse response)
          Deprecated. Serve a connector resource from the classpath if the resource has previously been registered by calling registerResource(String, Class).
protected  boolean streamToReceiver(java.io.InputStream in, StreamVariable streamVariable, java.lang.String filename, java.lang.String type, int contentLength)
          Deprecated.  
protected  java.lang.String unescapeBurst(java.lang.String encodedValue)
          Deprecated. Unescape encoded burst separator characters in a burst received from the client.
 void writeUidlResponse(WrappedRequest request, boolean repaintAll, java.io.PrintWriter outWriter, UI ui, boolean analyzeLayouts)
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VAR_BURST_SEPARATOR

public static final char VAR_BURST_SEPARATOR
Deprecated. 
See Also:
Constant Field Values

VAR_ESCAPE_CHARACTER

public static final char VAR_ESCAPE_CHARACTER
Deprecated. 
See Also:
Constant Field Values
Constructor Detail

AbstractCommunicationManager

public AbstractCommunicationManager(VaadinSession session)
Deprecated. 
TODO New constructor - document me!

Parameters:
session -
Method Detail

getVaadinSession

protected VaadinSession getVaadinSession()
Deprecated. 

doHandleSimpleMultipartFileUpload

protected void doHandleSimpleMultipartFileUpload(WrappedRequest request,
                                                 WrappedResponse response,
                                                 StreamVariable streamVariable,
                                                 java.lang.String variableName,
                                                 ClientConnector owner,
                                                 java.lang.String boundary)
                                          throws java.io.IOException
Deprecated. 
Method used to stream content from a multipart request (either from servlet or portlet request) to given StreamVariable

Parameters:
request -
response -
streamVariable -
owner -
boundary -
Throws:
java.io.IOException

doHandleXhrFilePost

protected void doHandleXhrFilePost(WrappedRequest request,
                                   WrappedResponse response,
                                   StreamVariable streamVariable,
                                   java.lang.String variableName,
                                   ClientConnector owner,
                                   int contentLength)
                            throws java.io.IOException
Deprecated. 
Used to stream plain file post (aka XHR2.post(File))

Parameters:
request -
response -
streamVariable -
owner -
contentLength -
Throws:
java.io.IOException

streamToReceiver

protected final boolean streamToReceiver(java.io.InputStream in,
                                         StreamVariable streamVariable,
                                         java.lang.String filename,
                                         java.lang.String type,
                                         int contentLength)
                                  throws UploadException
Deprecated. 
Parameters:
in -
streamVariable -
filename -
type -
contentLength -
Returns:
true if the streamvariable has informed that the terminal can forget this variable
Throws:
UploadException

sendUploadResponse

protected void sendUploadResponse(WrappedRequest request,
                                  WrappedResponse response)
                           throws java.io.IOException
Deprecated. 
TODO document

Parameters:
request -
response -
Throws:
java.io.IOException

handleUidlRequest

public void handleUidlRequest(WrappedRequest request,
                              WrappedResponse response,
                              AbstractCommunicationManager.Callback callback,
                              UI uI)
                       throws java.io.IOException,
                              AbstractCommunicationManager.InvalidUIDLSecurityKeyException,
                              org.json.JSONException
Deprecated. 
Internally process a UIDL request from the client. This method calls handleVariables(WrappedRequest, WrappedResponse, Callback, VaadinSession, UI) to process any changes to variables by the client and then repaints affected components using #paintAfterVariableChanges(). Also, some cleanup is done when a request arrives for an session that has already been closed. The method handleUidlRequest(...) in subclasses should call this method. TODO better documentation

Parameters:
request -
response -
callback -
uI - target window for the UIDL request, can be null if target not found
Throws:
java.io.IOException
AbstractCommunicationManager.InvalidUIDLSecurityKeyException
org.json.JSONException

postPaint

protected void postPaint(UI uI)
Deprecated. 
Method called after the paint phase while still being synchronized on the session

Parameters:
uI -

highlightConnector

protected void highlightConnector(com.vaadin.shared.Connector highlightedConnector)
Deprecated. 

printHighlightedComponentHierarchy

protected void printHighlightedComponentHierarchy(java.lang.StringBuilder sb,
                                                  AbstractComponent component)
Deprecated. 

getSecurityKeyUIDL

public java.lang.String getSecurityKeyUIDL(WrappedRequest request)
Deprecated. 
Gets the security key (and generates one if needed) as UIDL.

Parameters:
request -
Returns:
the security key UIDL or "" if the feature is turned off

getSecurityKey

protected java.lang.String getSecurityKey(WrappedRequest request)
Deprecated. 
Gets the security key (and generates one if needed).

Parameters:
request -
Returns:
the security key

writeUidlResponse

public void writeUidlResponse(WrappedRequest request,
                              boolean repaintAll,
                              java.io.PrintWriter outWriter,
                              UI ui,
                              boolean analyzeLayouts)
                       throws PaintException,
                              org.json.JSONException
Deprecated. 
Throws:
PaintException
org.json.JSONException

encodeState

public static org.json.JSONObject encodeState(ClientConnector connector,
                                              com.vaadin.shared.communication.SharedState state)
                                       throws org.json.JSONException
Deprecated. 
Throws:
org.json.JSONException

isVisible

public static boolean isVisible(ClientConnector connector)
Deprecated. 
Checks if the connector is visible in context. For Components, isVisible(Component) is used. For other types of connectors, the contextual visibility of its first Component ancestor is used. If no Component ancestor is found, the connector is not visible.

Parameters:
connector - The connector to check
Returns:
true if the connector is visible to the client, false otherwise

getThemeResourceAsStream

protected abstract java.io.InputStream getThemeResourceAsStream(UI uI,
                                                                java.lang.String themeName,
                                                                java.lang.String resource)
Deprecated. 

isXSRFEnabled

public boolean isXSRFEnabled(VaadinSession session)
Deprecated. 
Returns false if the cross site request forgery protection is turned off.

Parameters:
session -
Returns:
false if the XSRF is turned off, true otherwise

handleBurst

public boolean handleBurst(WrappedRequest source,
                           UI uI,
                           java.lang.String burst)
Deprecated. 
Processes a message burst received from the client. A burst can contain any number of RPC calls, including legacy variable change calls that are processed separately. Consecutive changes to the value of the same variable are combined and changeVariables() is only called once for them. This preserves the Vaadin 6 semantics for components and add-ons that do not use Vaadin 7 RPC directly.

Parameters:
source -
uI - the UI receiving the burst
burst - the content of the burst as a String to be parsed
Returns:
true if the processing of the burst was successful and there were no messages to non-existent components

changeVariables

protected void changeVariables(java.lang.Object source,
                               VariableOwner owner,
                               java.util.Map<java.lang.String,java.lang.Object> m)
Deprecated. 

getConnector

protected ClientConnector getConnector(UI uI,
                                       java.lang.String connectorId)
Deprecated. 

getRequestPayload

protected java.lang.String getRequestPayload(WrappedRequest request)
                                      throws java.io.IOException
Deprecated. 
Reads the request data from the Request and returns it converted to an UTF-8 string.

Parameters:
request -
Returns:
Throws:
java.io.IOException

unescapeBurst

protected java.lang.String unescapeBurst(java.lang.String encodedValue)
Deprecated. 
Unescape encoded burst separator characters in a burst received from the client. This protects from separator injection attacks.

Parameters:
encodedValue - to decode
Returns:
decoded value

closeJsonMessage

protected void closeJsonMessage(java.io.PrintWriter outWriter)
Deprecated. 

openJsonMessage

protected void openJsonMessage(java.io.PrintWriter outWriter,
                               WrappedResponse response)
Deprecated. 
Writes the opening of JSON message to be sent to client.

Parameters:
outWriter -
response -

requireLocale

public void requireLocale(java.lang.String value)
Deprecated. 
Queues a locale to be sent to the client (browser) for date and time entry etc. All locale specific information is derived from server-side Locale instances and sent to the client when needed, eliminating the need to use the Locale class and all the framework behind it on the client.

Parameters:
value -
See Also:
Locale.toString()

getStreamVariableTargetUrl

public java.lang.String getStreamVariableTargetUrl(ClientConnector owner,
                                                   java.lang.String name,
                                                   StreamVariable value)
Deprecated. 

cleanStreamVariable

public void cleanStreamVariable(ClientConnector owner,
                                java.lang.String name)
Deprecated. 

createBootstrapHandler

@Deprecated
protected abstract BootstrapHandler createBootstrapHandler()
Deprecated. might be refactored or removed before 7.0.0

Returns:

handleApplicationRequest

protected boolean handleApplicationRequest(WrappedRequest request,
                                           WrappedResponse response)
                                    throws java.io.IOException
Deprecated. 
Handles a request by passing it to each registered RequestHandler in turn until one produces a response. This method is used for requests that have not been handled by any specific functionality in the terminal implementation (e.g. VaadinServlet).

The request handlers are invoked in the revere order in which they were added to the session until a response has been produced. This means that the most recently added handler is used first and the first request handler that was added to the session is invoked towards the end unless any previous handler has already produced a response.

Parameters:
request - the wrapped request to get information from
response - the response to which data can be written
Returns:
returns true if a RequestHandler has produced a response and false if no response has been written.
Throws:
java.io.IOException - if a handler throws an exception
Since:
7.0
See Also:
VaadinSession.addRequestHandler(RequestHandler), RequestHandler

handleBrowserDetailsRequest

public void handleBrowserDetailsRequest(WrappedRequest request,
                                        WrappedResponse response,
                                        VaadinSession session)
                                 throws java.io.IOException
Deprecated. 
Throws:
java.io.IOException

getInitialUIDL

protected java.lang.String getInitialUIDL(WrappedRequest request,
                                          UI uI)
                                   throws PaintException,
                                          org.json.JSONException
Deprecated. 
Generates the initial UIDL message that can e.g. be included in a html page to avoid a separate round trip just for getting the UIDL.

Parameters:
request - the request that caused the initialization
uI - the UI for which the UIDL should be generated
Returns:
a string with the initial UIDL message
Throws:
PaintException - if an exception occurs while painting
org.json.JSONException - if an exception occurs while encoding output

serveConnectorResource

public void serveConnectorResource(WrappedRequest request,
                                   WrappedResponse response)
                            throws java.io.IOException
Deprecated. 
Serve a connector resource from the classpath if the resource has previously been registered by calling registerResource(String, Class). Sending arbitrary files from the classpath is prevented by only accepting resource names that have explicitly been registered. Resources can currently only be registered by including a JavaScript or StyleSheet annotation on a Connector class.

Parameters:
request -
response -
Throws:
java.io.IOException

handleFileUpload

public void handleFileUpload(VaadinSession session,
                             WrappedRequest request,
                             WrappedResponse response)
                      throws java.io.IOException,
                             AbstractCommunicationManager.InvalidUIDLSecurityKeyException
Deprecated. 
Handles file upload request submitted via Upload component.

Parameters:
UI - The UI for this request
request -
response -
Throws:
java.io.IOException
AbstractCommunicationManager.InvalidUIDLSecurityKeyException
See Also:
#getStreamVariableTargetUrl(ReceiverOwner, String, StreamVariable)

handleHeartbeatRequest

public void handleHeartbeatRequest(WrappedRequest request,
                                   WrappedResponse response,
                                   VaadinSession session)
                            throws java.io.IOException
Deprecated. 
Handles a heartbeat request. Heartbeat requests are periodically sent by the client-side to inform the server that the UI sending the heartbeat is still alive (the browser window is open, the connection is up) even when there are no UIDL requests for a prolonged period of time. UIs that do not receive either heartbeat or UIDL requests are eventually removed from the session and garbage collected.

Parameters:
request -
response -
session -
Throws:
java.io.IOException

getStreamVariable

public StreamVariable getStreamVariable(java.lang.String connectorId,
                                        java.lang.String variableName)
Deprecated. 


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