log = console.log;
}
- var loadTheme = function(url) {
+ var loadTheme = function(url, version) {
if(!themesLoaded[url]) {
- log("loadTheme", url);
+ log("loadTheme", url, version);
+
+ var href = url + '/styles.css';
+ if (version) {
+ href += '?v=' + version;
+ }
+
var stylesheet = document.createElement('link');
stylesheet.setAttribute('rel', 'stylesheet');
stylesheet.setAttribute('type', 'text/css');
- stylesheet.setAttribute('href', url + "/styles.css");
+ stylesheet.setAttribute('href', href);
document.getElementsByTagName('head')[0].appendChild(stylesheet);
themesLoaded[url] = true;
}
var bootstrapApp = function(mayDefer) {
var vaadinDir = getConfig('vaadinDir');
+ var versionInfo = getConfig('versionInfo');
+
var themeUri = vaadinDir + 'themes/' + getConfig('theme');
- loadTheme(themeUri);
+ loadTheme(themeUri, versionInfo && versionInfo['vaadinVersion']);
var widgetset = getConfig('widgetset');
var widgetsetUrl = getConfig('widgetsetUrl');
import com.vaadin.client.ResourceLoader.ResourceLoadListener;
import com.vaadin.client.VConsole;
import com.vaadin.shared.ApplicationConstants;
+import com.vaadin.shared.Version;
import com.vaadin.shared.communication.PushConstants;
import com.vaadin.shared.ui.ui.UIConstants;
import com.vaadin.shared.ui.ui.UIState.PushConfigurationState;
}-*/;
private void runWhenAtmosphereLoaded(final Command command) {
-
if (isAtmosphereLoaded()) {
command.execute();
} else {
- final String pushJs;
- if (ApplicationConfiguration.isProductionMode()) {
- pushJs = ApplicationConstants.VAADIN_PUSH_JS;
- } else {
- pushJs = ApplicationConstants.VAADIN_PUSH_DEBUG_JS;
- }
+ final String pushJs = getVersionedPushJs();
VConsole.log("Loading " + pushJs);
ResourceLoader.get().loadScript(
}
}
+ private String getVersionedPushJs() {
+ String pushJs;
+ if (ApplicationConfiguration.isProductionMode()) {
+ pushJs = ApplicationConstants.VAADIN_PUSH_JS;
+ } else {
+ pushJs = ApplicationConstants.VAADIN_PUSH_DEBUG_JS;
+ }
+ // Parameter appended to bypass caches after version upgrade.
+ pushJs += "?v=" + Version.getFullVersion();
+ return pushJs;
+ }
+
/*
* (non-Javadoc)
*
import com.vaadin.server.Page.Styles;
import com.vaadin.shared.ApplicationConstants;
import com.vaadin.shared.MouseEventDetails;
+import com.vaadin.shared.Version;
import com.vaadin.shared.communication.MethodInvocation;
import com.vaadin.shared.ui.ComponentStateUtil;
import com.vaadin.shared.ui.Connect;
* @return The URL the theme can be loaded from
*/
private String getThemeUrl(String theme) {
- return getConnection().translateVaadinUri(
+ String themeUrl = getConnection().translateVaadinUri(
ApplicationConstants.VAADIN_PROTOCOL_PREFIX + "themes/" + theme
+ "/styles" + ".css");
+ // Parameter appended to bypass caches after version upgrade.
+ themeUrl += "?v=" + Version.getFullVersion();
+ return themeUrl;
+
}
/**
String vaadinLocation = vaadinService.getStaticFileLocation(request)
+ "/VAADIN/";
+ // Parameter appended to JS to bypass caches after version upgrade.
+ String versionQueryParam = "?v=" + Version.getFullVersion();
+
if (context.getPushMode().isEnabled()) {
// Load client-side dependencies for push support
String pushJS = vaadinLocation;
pushJS += ApplicationConstants.VAADIN_PUSH_DEBUG_JS;
}
+ pushJS += versionQueryParam;
+
fragmentNodes.add(new Element(Tag.valueOf("script"), "").attr(
"type", "text/javascript").attr("src", pushJS));
}
String bootstrapLocation = vaadinLocation
- + ApplicationConstants.VAADIN_BOOTSTRAP_JS;
+ + ApplicationConstants.VAADIN_BOOTSTRAP_JS + versionQueryParam;
fragmentNodes.add(new Element(Tag.valueOf("script"), "").attr("type",
"text/javascript").attr("src", bootstrapLocation));
Element mainScriptTag = new Element(Tag.valueOf("script"), "").attr(
}
/**
- * Don not override.
+ * Do not override.
*
* @param context
* @return