getRequestHandlers() {
@@ -1381,7 +1384,7 @@ public abstract class VaadinService implements Serializable {
* request handler handles session expiration a default expiration message
* will be written.
*
- *
+ *
* @param request
* The incoming request
* @param response
@@ -1473,7 +1476,7 @@ public abstract class VaadinService implements Serializable {
/**
* Writes the given string as a response using the given content type.
- *
+ *
* @param response
* The response reference
* @param contentType
@@ -1498,7 +1501,7 @@ public abstract class VaadinService implements Serializable {
/**
* Called when the session has expired and the request handling is therefore
* aborted.
- *
+ *
* @param request
* The request
* @param response
@@ -1553,7 +1556,7 @@ public abstract class VaadinService implements Serializable {
/**
* Creates a JSON message which, when sent to client as-is, will cause a
* critical error to be shown with the given details.
- *
+ *
* @param caption
* The caption of the error or null to omit
* @param message
@@ -1616,10 +1619,10 @@ public abstract class VaadinService implements Serializable {
/**
* Enables push if push support is available and push has not yet been
* enabled.
- *
+ *
* If push support is not available, a warning explaining the situation will
* be logged at least the first time this method is invoked.
- *
+ *
* @return true
if push can be used; false
if push
* is not available.
*/
@@ -1638,7 +1641,7 @@ public abstract class VaadinService implements Serializable {
* internally used by {@link VaadinSession#accessSynchronously(Runnable)}
* and {@link UI#accessSynchronously(Runnable)} to help avoid causing
* deadlocks.
- *
+ *
* @since 7.1
* @param session
* the session that is being locked
@@ -1657,7 +1660,7 @@ public abstract class VaadinService implements Serializable {
* provided one for which the current thread holds a lock. This method might
* not detect all cases where some other session is locked, but it should
* cover the most typical situations.
- *
+ *
* @since 7.2
* @param session
* the session that is expected to be locked
@@ -1681,11 +1684,11 @@ public abstract class VaadinService implements Serializable {
* to allow a certain type of testing. For these cases, the check can be
* disabled by setting the init parameter
* disable-xsrf-protection
to true
.
- *
+ *
* @see DeploymentConfiguration#isXsrfProtectionEnabled()
- *
+ *
* @since 7.1
- *
+ *
* @param session
* the vaadin session for which the check should be done
* @param requestToken
@@ -1712,15 +1715,15 @@ public abstract class VaadinService implements Serializable {
* Implementation for {@link VaadinSession#access(Runnable)}. This method is
* implemented here instead of in {@link VaadinSession} to enable overriding
* the implementation without using a custom subclass of VaadinSession.
- *
+ *
* @since 7.1
* @see VaadinSession#access(Runnable)
- *
+ *
* @param session
* the vaadin session to access
* @param runnable
* the runnable to run with the session locked
- *
+ *
* @return a future that can be used to check for task completion and to
* cancel the task
*/
@@ -1739,7 +1742,7 @@ public abstract class VaadinService implements Serializable {
* thread, the queue will be purged when the session is unlocked. If the
* lock is not held by any thread, it is acquired and the queue is purged
* right away.
- *
+ *
* @since 7.1.2
* @param session
* the session for which the access queue should be purged
@@ -1775,7 +1778,7 @@ public abstract class VaadinService implements Serializable {
*
* This method is automatically run by the framework at appropriate
* situations and is not intended to be used by application developers.
- *
+ *
* @param session
* the vaadin session to purge the queue for
* @since 7.1
@@ -1817,11 +1820,11 @@ public abstract class VaadinService implements Serializable {
/**
* Adds a service destroy listener that gets notified when this service is
* destroyed.
- *
+ *
* @since 7.2
* @param listener
* the service destroy listener to add
- *
+ *
* @see #destroy()
* @see #removeServiceDestroyListener(ServiceDestroyListener)
* @see ServiceDestroyListener
@@ -1834,7 +1837,7 @@ public abstract class VaadinService implements Serializable {
/**
* Removes a service destroy listener that was previously added with
* {@link #addServiceDestroyListener(ServiceDestroyListener)}.
- *
+ *
* @since 7.2
* @param listener
* the service destroy listener to remove
@@ -1848,11 +1851,11 @@ public abstract class VaadinService implements Serializable {
* Called when the servlet, portlet or similar for this service is being
* destroyed. After this method has been called, no more requests will be
* handled by this service.
- *
+ *
* @see #addServiceDestroyListener(ServiceDestroyListener)
* @see Servlet#destroy()
* @see Portlet#destroy()
- *
+ *
* @since 7.2
*/
public void destroy() {
diff --git a/server/src/com/vaadin/server/communication/LegacyUidlWriter.java b/server/src/com/vaadin/server/communication/LegacyUidlWriter.java
index 43ea1aca67..3f70a25c5b 100644
--- a/server/src/com/vaadin/server/communication/LegacyUidlWriter.java
+++ b/server/src/com/vaadin/server/communication/LegacyUidlWriter.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -35,7 +35,7 @@ import com.vaadin.ui.UI;
/**
* Serializes legacy UIDL changes to JSON.
- *
+ *
* @author Vaadin Ltd
* @since 7.1
*/
@@ -44,7 +44,7 @@ public class LegacyUidlWriter implements Serializable {
/**
* Writes a JSON array containing the changes of all dirty
* {@link LegacyComponent}s in the given UI.
- *
+ *
* @param ui
* The {@link UI} whose legacy changes to write
* @param writer
@@ -60,7 +60,8 @@ public class LegacyUidlWriter implements Serializable {
Collection dirtyVisibleConnectors = ui
.getConnectorTracker().getDirtyVisibleConnectors();
- List legacyComponents = new ArrayList();
+ List legacyComponents = new ArrayList(
+ dirtyVisibleConnectors.size());
for (ClientConnector connector : dirtyVisibleConnectors) {
// All Components that want to use paintContent must implement
// LegacyComponent
diff --git a/server/src/com/vaadin/server/communication/ServerRpcHandler.java b/server/src/com/vaadin/server/communication/ServerRpcHandler.java
index 36bfc8bcc6..6f1d44d087 100644
--- a/server/src/com/vaadin/server/communication/ServerRpcHandler.java
+++ b/server/src/com/vaadin/server/communication/ServerRpcHandler.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -55,7 +55,7 @@ import com.vaadin.ui.UI;
/**
* Handles a client-to-server message containing serialized {@link ServerRpc
* server RPC} invocations.
- *
+ *
* @author Vaadin Ltd
* @since 7.1
*/
@@ -64,7 +64,7 @@ public class ServerRpcHandler implements Serializable {
/**
* A data transfer object representing an RPC request sent by the client
* side.
- *
+ *
* @since 7.2
* @author Vaadin Ltd
*/
@@ -91,7 +91,7 @@ public class ServerRpcHandler implements Serializable {
/**
* Gets the CSRF security token (double submit cookie) for this request.
- *
+ *
* @return the CSRF security token for this current change request
*/
public String getCsrfToken() {
@@ -100,7 +100,7 @@ public class ServerRpcHandler implements Serializable {
/**
* Gets the data to recreate the RPC as requested by the client side.
- *
+ *
* @return the data describing which RPC should be made, and all their
* data
*/
@@ -110,7 +110,7 @@ public class ServerRpcHandler implements Serializable {
/**
* Gets the sync id last seen by the client.
- *
+ *
* @return the last sync id given by the server, according to the
* client's request
*/
@@ -124,9 +124,9 @@ public class ServerRpcHandler implements Serializable {
*
* Note: This is a shared reference - any modifications made
* will be shared.
- *
+ *
* @return the raw JSON object that was received from the client
- *
+ *
*/
public JSONObject getRawJson() {
return json;
@@ -138,7 +138,7 @@ public class ServerRpcHandler implements Serializable {
/**
* Reads JSON containing zero or more serialized RPC calls (including legacy
* variable changes) and executes the calls.
- *
+ *
* @param ui
* The {@link UI} receiving the calls. Cannot be null.
* @param reader
@@ -188,7 +188,7 @@ public class ServerRpcHandler implements Serializable {
* 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.
- *
+ *
* @param uI
* the UI receiving the invocations data
* @param lastSyncIdSeenByClient
@@ -318,7 +318,7 @@ public class ServerRpcHandler implements Serializable {
/**
* Parse JSON from the client into a list of MethodInvocation instances.
- *
+ *
* @param connectorTracker
* The ConnectorTracker used to lookup connectors
* @param invocationsJson
@@ -333,11 +333,13 @@ public class ServerRpcHandler implements Serializable {
private List parseInvocations(
ConnectorTracker connectorTracker, JSONArray invocationsJson,
int lastSyncIdSeenByClient) throws JSONException {
- ArrayList invocations = new ArrayList();
+ int invocationCount = invocationsJson.length();
+ ArrayList invocations = new ArrayList(
+ invocationCount);
MethodInvocation previousInvocation = null;
// parse JSON to MethodInvocations
- for (int i = 0; i < invocationsJson.length(); ++i) {
+ for (int i = 0; i < invocationCount; ++i) {
JSONArray invocationJson = invocationsJson.getJSONArray(i);
@@ -500,7 +502,7 @@ public class ServerRpcHandler implements Serializable {
/**
* Generates an error message when the client is trying to to something
* ('what') with a connector which is disabled or invisible.
- *
+ *
* @since 7.1.8
* @param connector
* the connector which is disabled (or invisible)
diff --git a/server/src/com/vaadin/ui/ConnectorTracker.java b/server/src/com/vaadin/ui/ConnectorTracker.java
index b5a0227d99..9b8729f779 100644
--- a/server/src/com/vaadin/ui/ConnectorTracker.java
+++ b/server/src/com/vaadin/ui/ConnectorTracker.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -55,10 +55,10 @@ import com.vaadin.server.StreamVariable;
* operation new information needs to be sent to its
* {@link com.vaadin.client.ServerConnector}.
*
- *
+ *
* @author Vaadin Ltd
* @since 7.0.0
- *
+ *
*/
public class ConnectorTracker implements Serializable {
@@ -87,7 +87,7 @@ public class ConnectorTracker implements Serializable {
/**
* Map to track on which syncId each connector was removed.
- *
+ *
* @see #getCurrentSyncId()
* @see #cleanConcurrentlyRemovedConnectorIds(long)
*/
@@ -95,9 +95,9 @@ public class ConnectorTracker implements Serializable {
/**
* Gets a logger for this class
- *
+ *
* @return A logger instance for logging within this class
- *
+ *
*/
public static Logger getLogger() {
return Logger.getLogger(ConnectorTracker.class.getName());
@@ -107,7 +107,7 @@ public class ConnectorTracker implements Serializable {
* Creates a new ConnectorTracker for the given uI. A tracker is always
* attached to a uI and the uI cannot be changed during the lifetime of a
* {@link ConnectorTracker}.
- *
+ *
* @param uI
* The uI to attach to. Cannot be null.
*/
@@ -121,7 +121,7 @@ public class ConnectorTracker implements Serializable {
* The lookup method {@link #getConnector(String)} only returns registered
* connectors.
*
- *
+ *
* @param connector
* The connector to register.
*/
@@ -157,12 +157,12 @@ public class ConnectorTracker implements Serializable {
/**
* Unregister the given connector.
- *
+ *
*
* The lookup method {@link #getConnector(String)} only returns registered
* connectors.
*
- *
+ *
* @param connector
* The connector to unregister
*/
@@ -213,7 +213,7 @@ public class ConnectorTracker implements Serializable {
* Checks whether the given connector has already been initialized in the
* browser. The given connector should be registered with this connector
* tracker.
- *
+ *
* @param connector
* the client connector to check
* @return true
if the initial state has previously been sent
@@ -228,9 +228,9 @@ public class ConnectorTracker implements Serializable {
/**
* Marks the given connector as initialized, meaning that the client-side
* state has been initialized for the connector.
- *
+ *
* @see #isClientSideInitialized(ClientConnector)
- *
+ *
* @param connector
* the connector that should be marked as initialized
*/
@@ -242,7 +242,7 @@ public class ConnectorTracker implements Serializable {
* Marks all currently registered connectors as uninitialized. This should
* be done when the client-side has been reset but the server-side state is
* retained.
- *
+ *
* @see #isClientSideInitialized(ClientConnector)
*/
public void markAllClientSidesUninitialized() {
@@ -252,7 +252,7 @@ public class ConnectorTracker implements Serializable {
/**
* Gets a connector by its id.
- *
+ *
* @param connectorId
* The connector id to look for
* @return The connector with the given id or null if no connector has the
@@ -400,10 +400,10 @@ public class ConnectorTracker implements Serializable {
/**
* Mark the connector as dirty. This should not be done while the response
* is being written.
- *
+ *
* @see #getDirtyConnectors()
* @see #isWritingResponse()
- *
+ *
* @param connector
* The connector that should be marked clean.
*/
@@ -425,7 +425,7 @@ public class ConnectorTracker implements Serializable {
/**
* Mark the connector as clean.
- *
+ *
* @param connector
* The connector that should be marked clean.
*/
@@ -443,7 +443,7 @@ public class ConnectorTracker implements Serializable {
/**
* Returns {@link #getConnectorString(ClientConnector)} for the connector
* and its parent (if it has a parent).
- *
+ *
* @param connector
* The connector
* @return A string describing the connector and its parent
@@ -460,7 +460,7 @@ public class ConnectorTracker implements Serializable {
/**
* Returns a string with the connector name and id. Useful mostly for
* debugging and logging.
- *
+ *
* @param connector
* The connector
* @return A string that describes the connector
@@ -500,7 +500,7 @@ public class ConnectorTracker implements Serializable {
/**
* Marks all visible connectors dirty, starting from the given connector and
* going downwards in the hierarchy.
- *
+ *
* @param c
* The component to start iterating downwards from
*/
@@ -521,7 +521,7 @@ public class ConnectorTracker implements Serializable {
* The state and pending RPC calls for dirty connectors are sent to the
* client in the following request.
*
- *
+ *
* @return A collection of all dirty connectors for this uI. This list may
* contain invisible connectors.
*/
@@ -531,7 +531,7 @@ public class ConnectorTracker implements Serializable {
/**
* Checks if there a dirty connectors.
- *
+ *
* @return true if there are dirty connectors, false otherwise
*/
public boolean hasDirtyConnectors() {
@@ -541,17 +541,19 @@ public class ConnectorTracker implements Serializable {
/**
* Returns a collection of those {@link #getDirtyConnectors() dirty
* connectors} that are actually visible to the client.
- *
+ *
* @return A list of dirty and visible connectors.
*/
public ArrayList getDirtyVisibleConnectors() {
- ArrayList dirtyConnectors = new ArrayList();
- for (ClientConnector c : getDirtyConnectors()) {
+ Collection dirtyConnectors = getDirtyConnectors();
+ ArrayList dirtyVisibleConnectors = new ArrayList(
+ dirtyConnectors.size());
+ for (ClientConnector c : dirtyConnectors) {
if (LegacyCommunicationManager.isConnectorVisibleToClient(c)) {
- dirtyConnectors.add(c);
+ dirtyVisibleConnectors.add(c);
}
}
- return dirtyConnectors;
+ return dirtyVisibleConnectors;
}
public JSONObject getDiffState(ClientConnector connector) {
@@ -571,10 +573,10 @@ public class ConnectorTracker implements Serializable {
/**
* Checks whether the response is currently being written. Connectors can
* not be marked as dirty when a response is being written.
- *
+ *
* @see #setWritingResponse(boolean)
* @see #markDirty(ClientConnector)
- *
+ *
* @return true
if the response is currently being written,
* false
if outside the response writing phase.
*/
@@ -590,14 +592,14 @@ public class ConnectorTracker implements Serializable {
* {@link #getCurrentSyncId()}), if {@link #isWritingResponse()} returns
* false
and writingResponse
is set to
* true
.
- *
+ *
* @param writingResponse
* the new response status.
- *
+ *
* @see #markDirty(ClientConnector)
* @see #isWritingResponse()
* @see #getCurrentSyncId()
- *
+ *
* @throws IllegalArgumentException
* if the new response status is the same as the previous value.
* This is done to help detecting problems caused by missed
@@ -625,7 +627,7 @@ public class ConnectorTracker implements Serializable {
// Convert JSONObjects in diff state to String representation as
// JSONObject is not serializable
HashMap stringDiffStates = new HashMap(
- diffStates.size());
+ diffStates.size() * 2);
for (ClientConnector key : diffStates.keySet()) {
stringDiffStates.put(key, diffStates.get(key).toString());
}
@@ -643,7 +645,8 @@ public class ConnectorTracker implements Serializable {
@SuppressWarnings("unchecked")
HashMap stringDiffStates = (HashMap) in
.readObject();
- diffStates = new HashMap();
+ diffStates = new HashMap(
+ stringDiffStates.size() * 2);
for (ClientConnector key : stringDiffStates.keySet()) {
try {
diffStates.put(key, new JSONObject(stringDiffStates.get(key)));
@@ -657,7 +660,7 @@ public class ConnectorTracker implements Serializable {
/**
* Checks if the indicated connector has a StreamVariable of the given name
* and returns the variable if one is found.
- *
+ *
* @param connectorId
* @param variableName
* @return variable if a matching one exists, otherwise null
@@ -678,7 +681,7 @@ public class ConnectorTracker implements Serializable {
/**
* Adds a StreamVariable of the given name to the indicated connector.
- *
+ *
* @param connectorId
* @param variableName
* @param variable
@@ -734,7 +737,7 @@ public class ConnectorTracker implements Serializable {
/**
* Removes any StreamVariable of the given name from the indicated
* connector.
- *
+ *
* @param connectorId
* @param variableName
*/
@@ -752,7 +755,7 @@ public class ConnectorTracker implements Serializable {
/**
* Returns the security key associated with the given StreamVariable.
- *
+ *
* @param variable
* @return matching security key if one exists, null otherwise
*/
@@ -767,7 +770,7 @@ public class ConnectorTracker implements Serializable {
* Check whether a connector was present on the client when the it was
* creating this request, but was removed server-side before the request
* arrived.
- *
+ *
* @since 7.2
* @param connectorId
* The connector id to check for whether it was removed
@@ -827,7 +830,7 @@ public class ConnectorTracker implements Serializable {
*
* The sync id value -1
is ignored to facilitate testing with
* pre-recorded requests.
- *
+ *
* @see #setWritingResponse(boolean)
* @see #connectorWasPresentAsRequestWasSent(String, long)
* @since 7.2
@@ -853,7 +856,7 @@ public class ConnectorTracker implements Serializable {
*
* The sync id value -1
is ignored to facilitate testing with
* pre-recorded requests.
- *
+ *
* @see #connectorWasPresentAsRequestWasSent(String, long)
* @since 7.2
* @param lastSyncIdSeenByClient
--
2.39.5