aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Englund <marc.englund@itmill.com>2011-04-26 12:00:55 +0000
committerMarc Englund <marc.englund@itmill.com>2011-04-26 12:00:55 +0000
commitf1d990db156500ad456dc2567b246b73c3ea2a8f (patch)
treebb99127c2ca0d1cf2bce3b0f457165c43103a2a6 /src
parent9018524e84c50532b7b74f574f672f954d60f847 (diff)
downloadvaadin-framework-f1d990db156500ad456dc2567b246b73c3ea2a8f.tar.gz
vaadin-framework-f1d990db156500ad456dc2567b246b73c3ea2a8f.zip
Fixes #5423 Warns serverside if widgetset does not match vaadin version
svn changeset:18464/svn branch:6.6
Diffstat (limited to 'src')
-rwxr-xr-xsrc/com/vaadin/terminal/gwt/client/ApplicationConnection.java4
-rw-r--r--src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java19
-rw-r--r--src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java18
-rw-r--r--src/com/vaadin/terminal/gwt/server/Constants.java9
4 files changed, 49 insertions, 1 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
index 3d2bd950ac..d5d9578bd9 100755
--- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
+++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
@@ -352,6 +352,7 @@ public class ApplicationConnection {
int screenHeight = BrowserInfo.get().getScreenHeight();
int tzOffset = BrowserInfo.get().getTimezoneOffset();
int rtzOffset = BrowserInfo.get().getRawTimezoneOffset();
+ String widgetsetVersion = ApplicationConfiguration.VERSION;
String token = History.getToken();
@@ -361,7 +362,8 @@ public class ApplicationConnection {
String parameters = "repaintAll=1&" + "sh=" + screenHeight + "&sw="
+ screenWidth + "&cw=" + clientWidth + "&ch=" + clientHeight
+ "&vw=" + offsetWidth + "&vh=" + offsetHeight + "&fr=" + token
- + "&tzo=" + tzOffset + "&rtzo=" + rtzOffset;
+ + "&tzo=" + tzOffset + "&rtzo=" + rtzOffset + "&wsver="
+ + widgetsetVersion;
return parameters;
}
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java b/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
index 8717a080b8..ed7ba10ec4 100644
--- a/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
+++ b/src/com/vaadin/terminal/gwt/server/AbstractApplicationPortlet.java
@@ -127,6 +127,21 @@ 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(PortletRequest request) {
+ if (!AbstractApplicationServlet.VERSION.equals(getHTTPRequestParameter(
+ request, "wsver"))) {
+ logger.warning(String.format(WIDGETSET_MISMATCH_INFO,
+ AbstractApplicationServlet.VERSION,
+ getHTTPRequestParameter(request, "wsver")));
+ }
+ }
+
private void checkProductionMode() {
// Check if the application is in production mode.
// We are in production mode if Debug=false or productionMode=true
@@ -431,6 +446,10 @@ 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(request);
+ }
applicationManager.handleUidlRequest(
(ResourceRequest) request,
(ResourceResponse) response, this, window);
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java b/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java
index 73b493ed41..6752f6013b 100644
--- a/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java
+++ b/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java
@@ -236,6 +236,19 @@ 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 Debug=false or productionMode=true
@@ -399,6 +412,11 @@ 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/Constants.java b/src/com/vaadin/terminal/gwt/server/Constants.java
index b23a9c1284..d60d723e24 100644
--- a/src/com/vaadin/terminal/gwt/server/Constants.java
+++ b/src/com/vaadin/terminal/gwt/server/Constants.java
@@ -29,6 +29,15 @@ public interface Constants {
+ "in web.xml. The default of 1h will be used.\n"
+ "===========================================================";
+ static final String WIDGETSET_MISMATCH_INFO = "\n"
+ + "=================================================================\n"
+ + "The widgetset in use does not seem to be built for the Vaadin\n"
+ + "version in use. This might cause strange problems - a\n"
+ + "recompile/deploy is strongly recommended.\n"
+ + " Vaadin version: %s\n"
+ + " Widgetset version: %s\n"
+ + "=================================================================";
+
static final String URL_PARAMETER_RESTART_APPLICATION = "restartApplication";
static final String URL_PARAMETER_CLOSE_APPLICATION = "closeApplication";
static final String URL_PARAMETER_REPAINT_ALL = "repaintAll";