|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vaadin.terminal.gwt.server.AbstractCommunicationManager
public abstract class AbstractCommunicationManager
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
ApplicationConnection
.
A server side component sends its state to the client in a paint request (see
Paintable
and PaintTarget
on the server side). The client
widget receives these paint requests as calls to
com.vaadin.terminal.gwt.client.Paintable#updateFromUIDL()
. The client
component communicates back to the server by sending a list of variable
changes (see ApplicationConnection#updateVariable()
and
VariableOwner.changeVariables(Object, Map)
).
TODO Document better!
Nested Class Summary | |
---|---|
static interface |
AbstractCommunicationManager.Callback
TODO Document me! |
class |
AbstractCommunicationManager.ErrorHandlerErrorEvent
|
protected class |
AbstractCommunicationManager.InvalidUIDLSecurityKeyException
|
static interface |
AbstractCommunicationManager.Request
Generic interface of a (HTTP or Portlet) request to the application. |
static interface |
AbstractCommunicationManager.Response
Generic interface of a (HTTP or Portlet) response from the application. |
protected static interface |
AbstractCommunicationManager.Session
Generic wrapper interface for a (HTTP or Portlet) session. |
static class |
AbstractCommunicationManager.SimpleMultiPartInputStream
Stream that extracts content from another stream until the boundary string is encountered. |
class |
AbstractCommunicationManager.URIHandlerErrorImpl
Implementation of URIHandler.ErrorEvent interface. |
Field Summary | |
---|---|
static char |
VAR_ARRAYITEM_SEPARATOR
|
static char |
VAR_BURST_SEPARATOR
|
static char |
VAR_ESCAPE_CHARACTER
|
Constructor Summary | |
---|---|
AbstractCommunicationManager(Application application)
TODO New constructor - document me! |
Method Summary | |
---|---|
protected void |
changeVariables(Object source,
VariableOwner owner,
Map<String,Object> m)
|
protected abstract void |
cleanStreamVariable(VariableOwner owner,
String name)
|
protected void |
closeJsonMessage(PrintWriter outWriter)
|
protected String |
decodeVariableValue(String encodedValue)
Decode encoded burst, record, field and array item separator characters in a variable value String received from the client. |
protected Window |
doGetApplicationWindow(AbstractCommunicationManager.Request request,
AbstractCommunicationManager.Callback callback,
Application application,
Window assumedWindow)
TODO New method - document me! |
protected void |
doHandleSimpleMultipartFileUpload(AbstractCommunicationManager.Request request,
AbstractCommunicationManager.Response response,
StreamVariable streamVariable,
String variableName,
VariableOwner owner,
String boundary)
Method used to stream content from a multipart request (either from servlet or portlet request) to given StreamVariable |
protected void |
doHandleUidlRequest(AbstractCommunicationManager.Request request,
AbstractCommunicationManager.Response response,
AbstractCommunicationManager.Callback callback,
Window window)
Internally process a UIDL request from the client. |
protected void |
doHandleXhrFilePost(AbstractCommunicationManager.Request request,
AbstractCommunicationManager.Response response,
StreamVariable streamVariable,
String variableName,
VariableOwner owner,
int contentLength)
Used to stream plain file post (aka XHR2.post(File)) |
protected Application |
getApplication()
|
String |
getPaintableId(Paintable paintable)
Gets the Paintable Id. |
protected String |
getRequestPayload(AbstractCommunicationManager.Request request)
Reads the request data from the Request and returns it converted to an UTF-8 string. |
protected VariableOwner |
getVariableOwner(String string)
|
protected DownloadStream |
handleURI(Window window,
AbstractCommunicationManager.Request request,
AbstractCommunicationManager.Response response,
AbstractCommunicationManager.Callback callback)
Calls the Window URI handler for a request and returns the DownloadStream returned by the handler. |
boolean |
handleVariableBurst(Object source,
Application app,
boolean success,
String burst)
|
boolean |
hasPaintableId(Paintable paintable)
|
protected void |
highlightPaintable(Paintable highLightedPaintable2)
|
void |
makeAllPaintablesDirty(Window window)
|
protected void |
openJsonMessage(PrintWriter outWriter,
AbstractCommunicationManager.Response response)
Writes the opening of JSON message to be sent to client. |
protected void |
printHighlightedComponentHierarchy(StringBuilder sb,
AbstractComponent component)
|
void |
repaintRequested(Paintable.RepaintRequestEvent event)
Receives repaint request events. |
void |
requireLocale(String value)
Queues a locale to be sent to the client (browser) for date and time entry etc. |
protected void |
sendUploadResponse(AbstractCommunicationManager.Request request,
AbstractCommunicationManager.Response response)
TODO document |
protected boolean |
streamToReceiver(InputStream in,
StreamVariable streamVariable,
String filename,
String type,
int contentLength)
|
protected void |
unregisterPaintable(Component p)
Called when communication manager stops listening for repaints for given component. |
void |
writeUidlResponce(AbstractCommunicationManager.Callback callback,
boolean repaintAll,
PrintWriter outWriter,
Window window,
boolean analyzeLayouts)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char VAR_BURST_SEPARATOR
public static final char VAR_ARRAYITEM_SEPARATOR
public static final char VAR_ESCAPE_CHARACTER
Constructor Detail |
---|
public AbstractCommunicationManager(Application application)
application
- Method Detail |
---|
protected Application getApplication()
protected void doHandleSimpleMultipartFileUpload(AbstractCommunicationManager.Request request, AbstractCommunicationManager.Response response, StreamVariable streamVariable, String variableName, VariableOwner owner, String boundary) throws IOException
request
- response
- streamVariable
- owner
- boundary
-
IOException
protected void doHandleXhrFilePost(AbstractCommunicationManager.Request request, AbstractCommunicationManager.Response response, StreamVariable streamVariable, String variableName, VariableOwner owner, int contentLength) throws IOException
request
- response
- streamVariable
- owner
- contentLength
-
IOException
protected final boolean streamToReceiver(InputStream in, StreamVariable streamVariable, String filename, String type, int contentLength) throws UploadException
in
- streamVariable
- filename
- type
- contentLength
-
UploadException
protected void sendUploadResponse(AbstractCommunicationManager.Request request, AbstractCommunicationManager.Response response) throws IOException
request
- response
-
IOException
protected void doHandleUidlRequest(AbstractCommunicationManager.Request request, AbstractCommunicationManager.Response response, AbstractCommunicationManager.Callback callback, Window window) throws IOException, AbstractCommunicationManager.InvalidUIDLSecurityKeyException
handleVariables(Request, Response, Callback, Application, Window)
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 application that
has already been closed.
The method handleUidlRequest(...) in subclasses should call this method.
TODO better documentation
request
- response
- callback
- window
- target window for the UIDL request, can be null if target not
found
IOException
AbstractCommunicationManager.InvalidUIDLSecurityKeyException
protected void highlightPaintable(Paintable highLightedPaintable2)
protected void printHighlightedComponentHierarchy(StringBuilder sb, AbstractComponent component)
public void writeUidlResponce(AbstractCommunicationManager.Callback callback, boolean repaintAll, PrintWriter outWriter, Window window, boolean analyzeLayouts) throws PaintException
PaintException
public void makeAllPaintablesDirty(Window window)
protected void unregisterPaintable(Component p)
p
- public boolean handleVariableBurst(Object source, Application app, boolean success, String burst)
protected void changeVariables(Object source, VariableOwner owner, Map<String,Object> m)
protected VariableOwner getVariableOwner(String string)
protected String getRequestPayload(AbstractCommunicationManager.Request request) throws IOException
request
-
IOException
protected String decodeVariableValue(String encodedValue)
encodedValue
- to decode
protected Window doGetApplicationWindow(AbstractCommunicationManager.Request request, AbstractCommunicationManager.Callback callback, Application application, Window assumedWindow)
request
- callback
- application
- assumedWindow
-
protected void closeJsonMessage(PrintWriter outWriter)
protected void openJsonMessage(PrintWriter outWriter, AbstractCommunicationManager.Response response)
outWriter
- response
- public String getPaintableId(Paintable paintable)
paintable
-
public boolean hasPaintableId(Paintable paintable)
public void repaintRequested(Paintable.RepaintRequestEvent event)
Paintable.RepaintRequestListener
repaintRequested
in interface Paintable.RepaintRequestListener
event
- the repaint request event specifying the paintable source.Paintable.RepaintRequestListener.repaintRequested(com.vaadin.terminal.Paintable.RepaintRequestEvent)
public void requireLocale(String value)
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.
value
- Locale.toString()
protected DownloadStream handleURI(Window window, AbstractCommunicationManager.Request request, AbstractCommunicationManager.Response response, AbstractCommunicationManager.Callback callback)
DownloadStream
returned by the handler.
If the window is the main window of an application, the (deprecated)
Application.handleURI(java.net.URL, String)
is called first to
handle ApplicationResource
s, and the window handler is only
called if it returns null.
window
- the target window of the requestrequest
- the request instanceresponse
- the response to write to
URIHandler
protected abstract void cleanStreamVariable(VariableOwner owner, String name)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |