summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/server/DragAndDropService.java10
-rw-r--r--server/src/com/vaadin/server/LegacyCommunicationManager.java27
-rw-r--r--server/src/com/vaadin/server/VaadinSession.java9
-rw-r--r--server/src/com/vaadin/server/communication/FileUploadHandler.java3
-rw-r--r--server/src/com/vaadin/server/communication/ServerRpcHandler.java10
-rw-r--r--server/src/com/vaadin/server/communication/UidlWriter.java4
-rw-r--r--server/src/com/vaadin/ui/ConnectorTracker.java11
7 files changed, 37 insertions, 37 deletions
diff --git a/server/src/com/vaadin/server/DragAndDropService.java b/server/src/com/vaadin/server/DragAndDropService.java
index cef1bb86e7..0402a4997e 100644
--- a/server/src/com/vaadin/server/DragAndDropService.java
+++ b/server/src/com/vaadin/server/DragAndDropService.java
@@ -50,14 +50,14 @@ public class DragAndDropService implements VariableOwner, ClientConnector {
private DragAndDropEvent dragEvent;
- private final LegacyCommunicationManager manager;
+ private final VaadinSession session;
private AcceptCriterion acceptCriterion;
private ErrorHandler errorHandler;
- public DragAndDropService(LegacyCommunicationManager manager) {
- this.manager = manager;
+ public DragAndDropService(VaadinSession session) {
+ this.session = session;
}
@Override
@@ -233,8 +233,8 @@ public class DragAndDropService implements VariableOwner, ClientConnector {
outWriter.write(", \"dd\":");
- JsonPaintTarget jsonPaintTarget = new JsonPaintTarget(manager,
- outWriter, false);
+ JsonPaintTarget jsonPaintTarget = new JsonPaintTarget(
+ session.getCommunicationManager(), outWriter, false);
jsonPaintTarget.startTag("dd");
jsonPaintTarget.addAttribute("visitId", lastVisitId);
if (acceptCriterion != null) {
diff --git a/server/src/com/vaadin/server/LegacyCommunicationManager.java b/server/src/com/vaadin/server/LegacyCommunicationManager.java
index 8d61968b47..2b278e4858 100644
--- a/server/src/com/vaadin/server/LegacyCommunicationManager.java
+++ b/server/src/com/vaadin/server/LegacyCommunicationManager.java
@@ -62,9 +62,6 @@ public class LegacyCommunicationManager implements Serializable {
*/
private final VaadinSession session;
- // TODO Move to VaadinSession (#11409)
- private DragAndDropService dragAndDropService;
-
// TODO Refactor (#11412)
private String requestThemeName;
@@ -277,28 +274,14 @@ public class LegacyCommunicationManager implements Serializable {
}
/**
- * @deprecated As of 7.1. See #11411.
+ * @deprecated As of 7.1. In 7.2 and later, use
+ * {@link ConnectorTracker#getConnector(String)
+ * uI.getConnectorTracker().getConnector(connectorId)} instead.
+ * See ticket #11411.
*/
@Deprecated
public ClientConnector getConnector(UI uI, String connectorId) {
- ClientConnector c = uI.getConnectorTracker().getConnector(connectorId);
- if (c == null
- && connectorId.equals(getDragAndDropService().getConnectorId())) {
- return getDragAndDropService();
- }
-
- return c;
- }
-
- /**
- * @deprecated As of 7.1. See #11409.
- */
- @Deprecated
- public DragAndDropService getDragAndDropService() {
- if (dragAndDropService == null) {
- dragAndDropService = new DragAndDropService(this);
- }
- return dragAndDropService;
+ return uI.getConnectorTracker().getConnector(connectorId);
}
/**
diff --git a/server/src/com/vaadin/server/VaadinSession.java b/server/src/com/vaadin/server/VaadinSession.java
index 619a329ab9..134a026788 100644
--- a/server/src/com/vaadin/server/VaadinSession.java
+++ b/server/src/com/vaadin/server/VaadinSession.java
@@ -215,6 +215,8 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
protected WebBrowser browser = new WebBrowser();
+ private DragAndDropService dragAndDropService;
+
private LegacyCommunicationManager communicationManager;
private long cumulativeRequestDuration = 0;
@@ -395,6 +397,13 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
return communicationManager;
}
+ public DragAndDropService getDragAndDropService() {
+ if (dragAndDropService == null) {
+ dragAndDropService = new DragAndDropService(this);
+ }
+ return dragAndDropService;
+ }
+
/**
* Loads the VaadinSession for the given service and WrappedSession from the
* HTTP session.
diff --git a/server/src/com/vaadin/server/communication/FileUploadHandler.java b/server/src/com/vaadin/server/communication/FileUploadHandler.java
index dc397eadcd..7decfc2c0f 100644
--- a/server/src/com/vaadin/server/communication/FileUploadHandler.java
+++ b/server/src/com/vaadin/server/communication/FileUploadHandler.java
@@ -271,8 +271,7 @@ public class FileUploadHandler implements RequestHandler {
return true;
}
- source = session.getCommunicationManager().getConnector(uI,
- connectorId);
+ source = uI.getConnectorTracker().getConnector(connectorId);
} finally {
session.unlock();
}
diff --git a/server/src/com/vaadin/server/communication/ServerRpcHandler.java b/server/src/com/vaadin/server/communication/ServerRpcHandler.java
index ce9cec5e2a..3e7aec7cac 100644
--- a/server/src/com/vaadin/server/communication/ServerRpcHandler.java
+++ b/server/src/com/vaadin/server/communication/ServerRpcHandler.java
@@ -199,14 +199,16 @@ public class ServerRpcHandler implements Serializable {
.getCommunicationManager();
try {
+ ConnectorTracker connectorTracker = uI.getConnectorTracker();
+
Set<Connector> enabledConnectors = new HashSet<Connector>();
List<MethodInvocation> invocations = parseInvocations(
uI.getConnectorTracker(), invocationsData,
lastSyncIdSeenByClient);
for (MethodInvocation invocation : invocations) {
- final ClientConnector connector = manager.getConnector(uI,
- invocation.getConnectorId());
+ final ClientConnector connector = connectorTracker
+ .getConnector(invocation.getConnectorId());
if (connector != null && connector.isConnectorEnabled()) {
enabledConnectors.add(connector);
@@ -216,8 +218,8 @@ public class ServerRpcHandler implements Serializable {
for (int i = 0; i < invocations.size(); i++) {
MethodInvocation invocation = invocations.get(i);
- final ClientConnector connector = manager.getConnector(uI,
- invocation.getConnectorId());
+ final ClientConnector connector = connectorTracker
+ .getConnector(invocation.getConnectorId());
if (connector == null) {
getLogger()
.log(Level.WARNING,
diff --git a/server/src/com/vaadin/server/communication/UidlWriter.java b/server/src/com/vaadin/server/communication/UidlWriter.java
index 6c23da629e..893a87972d 100644
--- a/server/src/com/vaadin/server/communication/UidlWriter.java
+++ b/server/src/com/vaadin/server/communication/UidlWriter.java
@@ -285,9 +285,7 @@ public class UidlWriter implements Serializable {
+ new JSONArray(styleDependencies).toString());
}
- if (manager.getDragAndDropService() != null) {
- manager.getDragAndDropService().printJSONResponse(writer);
- }
+ session.getDragAndDropService().printJSONResponse(writer);
for (ClientConnector connector : dirtyVisibleConnectors) {
uiConnectorTracker.markClientSideInitialized(connector);
diff --git a/server/src/com/vaadin/ui/ConnectorTracker.java b/server/src/com/vaadin/ui/ConnectorTracker.java
index d985ffd124..af03dade3a 100644
--- a/server/src/com/vaadin/ui/ConnectorTracker.java
+++ b/server/src/com/vaadin/ui/ConnectorTracker.java
@@ -35,6 +35,7 @@ import org.json.JSONObject;
import com.vaadin.server.AbstractClientConnector;
import com.vaadin.server.ClientConnector;
+import com.vaadin.server.DragAndDropService;
import com.vaadin.server.GlobalResourceHandler;
import com.vaadin.server.LegacyCommunicationManager;
import com.vaadin.server.StreamVariable;
@@ -271,8 +272,16 @@ public class ConnectorTracker implements Serializable {
// Ignore connectors that have been unregistered but not yet cleaned up
if (unregisteredConnectors.contains(connector)) {
return null;
+ } else if (connector != null) {
+ return connector;
+ } else {
+ DragAndDropService service = uI.getSession()
+ .getDragAndDropService();
+ if (connectorId.equals(service.getConnectorId())) {
+ return service;
+ }
}
- return connector;
+ return null;
}
/**