diff options
author | Artur Signell <artur@vaadin.com> | 2013-06-18 22:27:11 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2013-06-18 22:27:12 +0300 |
commit | cc8bb2c509024076421abc37113cd7c6d8867571 (patch) | |
tree | 1f8ad0206ed4656b90776f9f93182f89f60977e2 /server/src/com | |
parent | faa693e33b24cb34e7811d94d5efe5605117af7f (diff) | |
parent | b637ab5945ef0340ce33dda7703e67181c879e4c (diff) | |
download | vaadin-framework-cc8bb2c509024076421abc37113cd7c6d8867571.tar.gz vaadin-framework-cc8bb2c509024076421abc37113cd7c6d8867571.zip |
Merge changes from origin/7.1
bad3208 Corrected fix and better error checking for action/event request (#12056)
a7957df Fixes broken request listeners (#12056)
d5dbae8 Exclude external classes and FutureAccess
b4fc9bc Define LegacyPropertyToStringMode parameter strings in the enum (#11970)
7fb8080 Don't attempt to run microbenchmarks as unit tests (#8759)
3067b23 DebugWindow sections now use previously empty areas to describe the functionality, for #12058
28f72b6 Highlight on server when highlighting on client, for #12058
86e1a31 VUIDLBrowser no longer requires shift-click to 'highlight component on server', open recursively changed to 'alt-click', for #12058
76b9cd1 DebugWindow styles improved and structured more, for #12058
1befbeb Test using Glassfish 4 (#12075)
78af0eb Specified supported server versions and added Glassfish 4 (#12075)
ad9c350 Fixed test issues with type=null (#11895)
8c4800a Updated to atmosphere 1.0.14-vaadin1
2d54adf Highlight on server was still spamming in one instance, for #12058
0754158 Rename getCommunicationMethod -> getCommunicationMethodName (#12019)
8669f6a Actually compile an IE10 permutation (#12080)
47c199f Add 'transport' GET parameter to AbstractTestUI (#12094)
b637ab5 Reinitialize pendingAccessQueue after deserialization (#12097)
Change-Id: Ie664f5c7ec4be2d4841d8b659d6a3ecd0c11624d
Diffstat (limited to 'server/src/com')
7 files changed, 81 insertions, 38 deletions
diff --git a/server/src/com/vaadin/server/Constants.java b/server/src/com/vaadin/server/Constants.java index 0ea9de252a..bcdb62064b 100644 --- a/server/src/com/vaadin/server/Constants.java +++ b/server/src/com/vaadin/server/Constants.java @@ -65,7 +65,7 @@ public interface Constants { + " Widgetset version: %s\n" + "================================================================="; - static final String REQUIRED_ATMOSPHERE_VERSION = "1.0.14-2"; + static final String REQUIRED_ATMOSPHERE_VERSION = "1.0.14-vaadin1"; static final String INVALID_ATMOSPHERE_VERSION_WARNING = "\n" + "=================================================================\n" diff --git a/server/src/com/vaadin/server/DefaultDeploymentConfiguration.java b/server/src/com/vaadin/server/DefaultDeploymentConfiguration.java index 993d60133b..519d81eb6d 100644 --- a/server/src/com/vaadin/server/DefaultDeploymentConfiguration.java +++ b/server/src/com/vaadin/server/DefaultDeploymentConfiguration.java @@ -86,27 +86,24 @@ public class DefaultDeploymentConfiguration implements DeploymentConfiguration { } private void checkLegacyPropertyToString() { - // Verify that the default value has not changed without also - // updating logic here - assert DEFAULT_LEGACY_PROPERTY_TO_STRING == LegacyProperyToStringMode.WARNING; - String param = getApplicationOrSystemProperty( - Constants.SERVLET_PARAMETER_LEGACY_PROPERTY_TOSTRING, "warning"); - - if ("true".equals(param)) { - legacyPropertyToStringMode = LegacyProperyToStringMode.ENABLED; - } else if ("false".equals(param)) { - legacyPropertyToStringMode = LegacyProperyToStringMode.DISABLED; - } else { - if (!"warning".equals(param)) { - getLogger() - .log(Level.WARNING, - Constants.WARNING_UNKNOWN_LEGACY_PROPERTY_TOSTRING_VALUE, - param); - + Constants.SERVLET_PARAMETER_LEGACY_PROPERTY_TOSTRING, + DEFAULT_LEGACY_PROPERTY_TO_STRING.getPropertyString()); + + for (LegacyProperyToStringMode mode : LegacyProperyToStringMode + .values()) { + if (mode.getPropertyString().equals(param)) { + legacyPropertyToStringMode = mode; + return; } - legacyPropertyToStringMode = DEFAULT_LEGACY_PROPERTY_TO_STRING; } + + getLogger() + .log(Level.WARNING, + Constants.WARNING_UNKNOWN_LEGACY_PROPERTY_TOSTRING_VALUE, + param); + + legacyPropertyToStringMode = DEFAULT_LEGACY_PROPERTY_TO_STRING; } @Override diff --git a/server/src/com/vaadin/server/DeploymentConfiguration.java b/server/src/com/vaadin/server/DeploymentConfiguration.java index bf9c019b6d..8c24379db3 100644 --- a/server/src/com/vaadin/server/DeploymentConfiguration.java +++ b/server/src/com/vaadin/server/DeploymentConfiguration.java @@ -40,7 +40,29 @@ public interface DeploymentConfiguration extends Serializable { */ @Deprecated public enum LegacyProperyToStringMode { - DISABLED, WARNING, ENABLED; + DISABLED("false"), WARNING("warning"), ENABLED("true"); + + private final String propertyString; + + private LegacyProperyToStringMode(String propertyString) { + this.propertyString = propertyString; + } + + /** + * Gets the string that should be used in e.g. web.xml for selecting + * this mode. + * + * @return the property value + */ + public String getPropertyString() { + return propertyString; + } + + @Override + public String toString() { + // Used by VaadinServlet.readConfigurationAnnotation() + return getPropertyString(); + } public boolean useLegacyMode() { return this == WARNING || this == ENABLED; diff --git a/server/src/com/vaadin/server/VaadinPortletResponse.java b/server/src/com/vaadin/server/VaadinPortletResponse.java index 334b94a5dc..ccb35a2c91 100644 --- a/server/src/com/vaadin/server/VaadinPortletResponse.java +++ b/server/src/com/vaadin/server/VaadinPortletResponse.java @@ -85,12 +85,23 @@ public class VaadinPortletResponse implements VaadinResponse { @Override public void setContentType(String type) { - ((MimeResponse) response).setContentType(type); + if (response instanceof MimeResponse) { + ((MimeResponse) response).setContentType(type); + } else { + throw new RuntimeException( + "Content type cannot be set for response of type " + + response.getClass().getName()); + } } @Override public PrintWriter getWriter() throws IOException { - return ((MimeResponse) response).getWriter(); + if (response instanceof MimeResponse) { + return ((MimeResponse) response).getWriter(); + } else { + throw new IOException("Writer not available for response of type " + + response.getClass().getName()); + } } @Override diff --git a/server/src/com/vaadin/server/VaadinSession.java b/server/src/com/vaadin/server/VaadinSession.java index 82f245594f..504788d479 100644 --- a/server/src/com/vaadin/server/VaadinSession.java +++ b/server/src/com/vaadin/server/VaadinSession.java @@ -203,7 +203,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * session is serialized as long as it doesn't happen while some other * thread has the lock. */ - private transient final ConcurrentLinkedQueue<FutureAccess> pendingAccessQueue = new ConcurrentLinkedQueue<FutureAccess>(); + private transient ConcurrentLinkedQueue<FutureAccess> pendingAccessQueue; /** * Create a new service session tied to a Vaadin service @@ -1250,6 +1250,11 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * @return the pending access queue */ public Queue<FutureAccess> getPendingAccessQueue() { + if (pendingAccessQueue == null) { + // pendingAccessQueue is transient, so will be null after + // deserialization + pendingAccessQueue = new ConcurrentLinkedQueue<FutureAccess>(); + } return pendingAccessQueue; } diff --git a/server/src/com/vaadin/server/communication/PortletListenerNotifier.java b/server/src/com/vaadin/server/communication/PortletListenerNotifier.java index 5c03a6f4dc..34e007c770 100644 --- a/server/src/com/vaadin/server/communication/PortletListenerNotifier.java +++ b/server/src/com/vaadin/server/communication/PortletListenerNotifier.java @@ -59,9 +59,9 @@ public class PortletListenerNotifier extends SynchronizedRequestHandler { VaadinRequest request, VaadinResponse response) throws IOException { VaadinPortletSession sess = (VaadinPortletSession) session; - PortletRequest req = ((VaadinPortletRequest) request) + PortletRequest portletRequest = ((VaadinPortletRequest) request) .getPortletRequest(); - PortletResponse resp = ((VaadinPortletResponse) response) + PortletResponse portletResponse = ((VaadinPortletResponse) response) .getPortletResponse(); // Finds the right UI @@ -70,18 +70,19 @@ public class PortletListenerNotifier extends SynchronizedRequestHandler { uI = session.getService().findUI(request); } - if (request instanceof RenderRequest) { - sess.firePortletRenderRequest(uI, (RenderRequest) req, - (RenderResponse) resp); - } else if (request instanceof ActionRequest) { - sess.firePortletActionRequest(uI, (ActionRequest) req, - (ActionResponse) resp); - } else if (request instanceof EventRequest) { - sess.firePortletEventRequest(uI, (EventRequest) req, - (EventResponse) resp); - } else if (request instanceof ResourceRequest) { - sess.firePortletResourceRequest(uI, (ResourceRequest) req, - (ResourceResponse) resp); + if (portletRequest instanceof RenderRequest) { + sess.firePortletRenderRequest(uI, (RenderRequest) portletRequest, + (RenderResponse) portletResponse); + } else if (portletRequest instanceof ActionRequest) { + sess.firePortletActionRequest(uI, (ActionRequest) portletRequest, + (ActionResponse) portletResponse); + } else if (portletRequest instanceof EventRequest) { + sess.firePortletEventRequest(uI, (EventRequest) portletRequest, + (EventResponse) portletResponse); + } else if (portletRequest instanceof ResourceRequest) { + sess.firePortletResourceRequest(uI, + (ResourceRequest) portletRequest, + (ResourceResponse) portletResponse); } return false; diff --git a/server/src/com/vaadin/server/communication/PortletStateAwareRequestHandler.java b/server/src/com/vaadin/server/communication/PortletStateAwareRequestHandler.java index 162c479fac..4072aae359 100644 --- a/server/src/com/vaadin/server/communication/PortletStateAwareRequestHandler.java +++ b/server/src/com/vaadin/server/communication/PortletStateAwareRequestHandler.java @@ -17,9 +17,11 @@ package com.vaadin.server.communication; import java.io.IOException; +import javax.portlet.PortletResponse; import javax.portlet.StateAwareResponse; import com.vaadin.server.RequestHandler; +import com.vaadin.server.VaadinPortletResponse; import com.vaadin.server.VaadinRequest; import com.vaadin.server.VaadinResponse; import com.vaadin.server.VaadinSession; @@ -43,7 +45,12 @@ public class PortletStateAwareRequestHandler implements RequestHandler { @Override public boolean handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) throws IOException { - if (response instanceof StateAwareResponse) { + if (!(response instanceof VaadinPortletResponse)) { + return false; + } + PortletResponse portletResponse = ((VaadinPortletResponse) response) + .getPortletResponse(); + if (portletResponse instanceof StateAwareResponse) { // StateAwareResponse is fully handled by listeners through // PortletListenerNotifier return true; |