aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/terminal
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-05-04 14:19:12 +0300
committerArtur Signell <artur@vaadin.com>2012-05-11 22:18:33 +0300
commit9fd13d260c3b0510272abed2170decf709f1062d (patch)
treeafd526a265bcd56886f6f3b2abb1c2b21727c73f /src/com/vaadin/terminal
parentd5ea720082ecbfea98310ea9c860d7ce0ce9757e (diff)
downloadvaadin-framework-9fd13d260c3b0510272abed2170decf709f1062d.tar.gz
vaadin-framework-9fd13d260c3b0510272abed2170decf709f1062d.zip
Send widgetset version with the first UIDL request
This enables the server to verify that the widgetset version match the servlet version
Diffstat (limited to 'src/com/vaadin/terminal')
-rw-r--r--src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java20
-rw-r--r--src/com/vaadin/terminal/gwt/client/ApplicationConnection.java13
-rw-r--r--src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java19
-rw-r--r--src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java63
-rw-r--r--src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java23
-rw-r--r--src/com/vaadin/terminal/gwt/server/BootstrapHandler.java7
6 files changed, 56 insertions, 89 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java b/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java
index ff77c5904a..8eeccb828d 100644
--- a/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java
+++ b/src/com/vaadin/terminal/gwt/client/ApplicationConfiguration.java
@@ -212,6 +212,7 @@ public class ApplicationConfiguration implements EntryPoint {
private Class<? extends ComponentConnector>[] classes = new Class[1024];
private boolean browserDetailsSent = false;
+ private boolean widgetsetVersionSent = false;
static// TODO consider to make this hashmap per application
LinkedList<Command> callbacks = new LinkedList<Command>();
@@ -645,4 +646,23 @@ public class ApplicationConfiguration implements EntryPoint {
browserDetailsSent = true;
}
+ /**
+ * Checks whether the widget set version has been sent to the server. It is
+ * sent in the first UIDL request.
+ *
+ * @return <code>true</code> if browser information has already been sent
+ *
+ * @see ApplicationConnection#getNativeBrowserDetailsParameters(String)
+ */
+ public boolean isWidgetsetVersionSent() {
+ return widgetsetVersionSent;
+ }
+
+ /**
+ * Registers that the widget set version has been sent to the server.
+ */
+ public void setWidgetsetVersionSent() {
+ widgetsetVersionSent = true;
+ }
+
}
diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
index 18b1afd813..8285e956e6 100644
--- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
+++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
@@ -416,13 +416,10 @@ public class ApplicationConnection {
// initial uidl request
String nativeBootstrapParameters = getNativeBrowserDetailsParameters(getConfiguration()
.getRootPanelId());
- String widgetsetVersion = ApplicationConfiguration.VERSION;
-
// TODO figure out how client and view size could be used better on
// server. screen size can be accessed via Browser object, but other
// values currently only via transaction listener.
- String parameters = "repaintAll=1&" + nativeBootstrapParameters
- + "&wsver=" + widgetsetVersion;
+ String parameters = "repaintAll=1&" + nativeBootstrapParameters;
return parameters;
}
@@ -1723,7 +1720,15 @@ public class ApplicationConnection {
} else {
extraParams = "";
}
+ if (!getConfiguration().isWidgetsetVersionSent()) {
+ if (!extraParams.isEmpty()) {
+ extraParams += "&";
+ }
+ String widgetsetVersion = ApplicationConfiguration.VERSION;
+ extraParams += "wsver=" + widgetsetVersion;
+ getConfiguration().setWidgetsetVersionSent();
+ }
makeUidlRequest(req.toString(), extraParams, forceSync);
}
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java b/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
index 77698805de..1acc9d128a 100644
--- a/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
+++ b/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
@@ -333,21 +333,6 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
}
}
- /**
- * Checks that the version reported by the client (widgetset) matches that
- * of the server.
- *
- * @param request
- */
- private void checkWidgetsetVersion(WrappedRequest request) {
- if (!AbstractApplicationServlet.VERSION.equals(request
- .getParameter("wsver"))) {
- logger.warning(String.format(WIDGETSET_MISMATCH_INFO,
- AbstractApplicationServlet.VERSION,
- request.getParameter("wsver")));
- }
- }
-
private void checkProductionMode() {
// TODO Identical code in AbstractApplicationServlet -> refactor
// Check if the application is in production mode.
@@ -674,10 +659,6 @@ public abstract class AbstractApplicationPortlet extends GenericPortlet
return;
} else if (requestType == RequestType.UIDL) {
// Handles AJAX UIDL requests
- if (isRepaintAll(request)) {
- // warn if versions do not match
- checkWidgetsetVersion(wrappedRequest);
- }
applicationManager.handleUidlRequest(wrappedRequest,
wrappedResponse, portletWrapper, root);
return;
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java b/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java
index 6ab2748332..905cfe7e3c 100644
--- a/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java
+++ b/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java
@@ -90,51 +90,6 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
private static final Logger logger = Logger
.getLogger(AbstractApplicationServlet.class.getName());
- /**
- * The version number of this release. For example "6.2.0". Always in the
- * format "major.minor.revision[.build]". The build part is optional. All of
- * major, minor, revision must be integers.
- */
- public static final String VERSION;
- /**
- * Major version number. For example 6 in 6.2.0.
- */
- public static final int VERSION_MAJOR;
-
- /**
- * Minor version number. For example 2 in 6.2.0.
- */
- public static final int VERSION_MINOR;
-
- /**
- * Version revision number. For example 0 in 6.2.0.
- */
- public static final int VERSION_REVISION;
-
- /**
- * Build identifier. For example "nightly-20091123-c9963" in
- * 6.2.0.nightly-20091123-c9963.
- */
- public static final String VERSION_BUILD;
-
- /* Initialize version numbers from string replaced by build-script. */
- static {
- if ("@VERSION@".equals("@" + "VERSION" + "@")) {
- VERSION = "9.9.9.INTERNAL-DEBUG-BUILD";
- } else {
- VERSION = "@VERSION@";
- }
- final String[] digits = VERSION.split("\\.", 4);
- VERSION_MAJOR = Integer.parseInt(digits[0]);
- VERSION_MINOR = Integer.parseInt(digits[1]);
- VERSION_REVISION = Integer.parseInt(digits[2]);
- if (digits.length == 4) {
- VERSION_BUILD = digits[3];
- } else {
- VERSION_BUILD = "";
- }
- }
-
private Properties applicationProperties;
private boolean productionMode = false;
@@ -235,19 +190,6 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
}
}
- /**
- * Checks that the version reported by the client (widgetset) matches that
- * of the server.
- *
- * @param request
- */
- private void checkWidgetsetVersion(HttpServletRequest request) {
- if (!VERSION.equals(request.getParameter("wsver"))) {
- logger.warning(String.format(WIDGETSET_MISMATCH_INFO, VERSION,
- request.getParameter("wsver")));
- }
- }
-
private void checkProductionMode() {
// Check if the application is in production mode.
// We are in production mode if productionMode=true
@@ -416,11 +358,6 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
return;
}
- if (isRepaintAll(request)) {
- // warn if versions do not match
- checkWidgetsetVersion(request);
- }
-
Application application = null;
boolean transactionStarted = false;
boolean requestStarted = false;
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
index 97cb3114b9..8f942d9aee 100644
--- a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
+++ b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java
@@ -45,6 +45,7 @@ import java.util.logging.Logger;
import com.vaadin.Application;
import com.vaadin.Application.SystemMessages;
import com.vaadin.RootRequiresMoreInformationException;
+import com.vaadin.Version;
import com.vaadin.external.json.JSONArray;
import com.vaadin.external.json.JSONException;
import com.vaadin.external.json.JSONObject;
@@ -499,6 +500,7 @@ public abstract class AbstractCommunicationManager implements Serializable {
WrappedResponse response, Callback callback, Root root)
throws IOException, InvalidUIDLSecurityKeyException {
+ checkWidgetsetVersion(request);
requestThemeName = request.getParameter("theme");
maxInactiveInterval = request.getSessionMaxInactiveInterval();
// repaint requested or session has timed out and new one is created
@@ -586,6 +588,27 @@ public abstract class AbstractCommunicationManager implements Serializable {
}
/**
+ * Checks that the version reported by the client (widgetset) matches that
+ * of the server.
+ *
+ * @param request
+ */
+ private void checkWidgetsetVersion(WrappedRequest request) {
+ String widgetsetVersion = request.getParameter("wsver");
+ if (widgetsetVersion == null) {
+ // Only check when the widgetset version is reported. It is reported
+ // in the first UIDL request (not the initial request as it is a
+ // plain GET /)
+ return;
+ }
+
+ if (!Version.getFullVersion().equals(widgetsetVersion)) {
+ logger.warning(String.format(Constants.WIDGETSET_MISMATCH_INFO,
+ Version.getFullVersion(), widgetsetVersion));
+ }
+ }
+
+ /**
* Method called after the paint phase while still being synchronized on the
* application
*
diff --git a/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java b/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java
index 84f87124d3..8a0c700121 100644
--- a/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java
+++ b/src/com/vaadin/terminal/gwt/server/BootstrapHandler.java
@@ -15,6 +15,7 @@ import javax.servlet.http.HttpServletResponse;
import com.vaadin.Application;
import com.vaadin.RootRequiresMoreInformationException;
+import com.vaadin.Version;
import com.vaadin.external.json.JSONException;
import com.vaadin.external.json.JSONObject;
import com.vaadin.terminal.DeploymentConfiguration;
@@ -370,7 +371,7 @@ public abstract class BootstrapHandler implements RequestHandler {
}
JSONObject versionInfo = new JSONObject();
- versionInfo.put("vaadinVersion", AbstractApplicationServlet.VERSION);
+ versionInfo.put("vaadinVersion", Version.getFullVersion());
versionInfo.put("applicationVersion", application.getVersion());
appConfig.put("versionInfo", versionInfo);
@@ -478,8 +479,8 @@ public abstract class BootstrapHandler implements RequestHandler {
}
Root root = context.getRoot();
- String title = ((root == null || root.getCaption() == null) ? "Vaadin "
- + AbstractApplicationServlet.VERSION_MAJOR : root.getCaption());
+ String title = ((root == null || root.getCaption() == null) ? "" : root
+ .getCaption());
page.write("<title>"
+ AbstractApplicationServlet.safeEscapeForHtml(title)