From: Artur Signell Date: Mon, 9 Sep 2013 11:38:21 +0000 (+0300) Subject: Use non-obfuscated version of vaadinPush.js when not in production (#12527) X-Git-Tag: 7.1.7~46 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e4d99b3631a70a9ca11c085b4de09b4daf400176;p=vaadin-framework.git Use non-obfuscated version of vaadinPush.js when not in production (#12527) Change-Id: I8e0baec2391b140e6a72eedf6606fd2792c735bc --- diff --git a/.gitignore b/.gitignore index d5899b3d58..30c8597b16 100644 --- a/.gitignore +++ b/.gitignore @@ -45,6 +45,7 @@ /WebContent/VAADIN/gwt-unitCache* WebContent/VAADIN/vaadinPush.js +WebContent/VAADIN/vaadinPush.debug.js # /WebContent/WEB-INF/ /WebContent/WEB-INF/classes diff --git a/build/ide.xml b/build/ide.xml index 1d1049026d..2605bf2cdd 100755 --- a/build/ide.xml +++ b/build/ide.xml @@ -134,6 +134,7 @@ + @@ -146,5 +147,7 @@ ${vaadinPush.js.contents} + + diff --git a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java index 20ccd45173..3cecb09dc1 100644 --- a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java +++ b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.core.client.Scheduler; import com.google.gwt.user.client.Command; +import com.vaadin.client.ApplicationConfiguration; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.ApplicationConnection.CommunicationErrorHandler; import com.vaadin.client.ResourceLoader; @@ -473,7 +474,13 @@ public class AtmospherePushConnection implements PushConnection { if (isAtmosphereLoaded()) { command.execute(); } else { - final String pushJs = ApplicationConstants.VAADIN_PUSH_JS; + final String pushJs; + if (ApplicationConfiguration.isProductionMode()) { + pushJs = ApplicationConstants.VAADIN_PUSH_JS; + } else { + pushJs = ApplicationConstants.VAADIN_PUSH_DEBUG_JS; + } + VConsole.log("Loading " + pushJs); ResourceLoader.get().loadScript( connection.getConfiguration().getVaadinDirUrl() + pushJs, diff --git a/push/build.xml b/push/build.xml index 829411ea12..1cbe23d75b 100644 --- a/push/build.xml +++ b/push/build.xml @@ -11,6 +11,7 @@ + @@ -21,13 +22,12 @@ + - - @@ -39,15 +39,17 @@ - ${vaadinPush.js.contents} + + + ${vaadinPush.js.contents} - - + + diff --git a/server/src/com/vaadin/server/BootstrapHandler.java b/server/src/com/vaadin/server/BootstrapHandler.java index b21fdb0b74..0a4949ffa7 100644 --- a/server/src/com/vaadin/server/BootstrapHandler.java +++ b/server/src/com/vaadin/server/BootstrapHandler.java @@ -388,9 +388,16 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler { if (context.getPushMode().isEnabled()) { // Load client-side dependencies for push support + String pushJS = vaadinLocation; + if (context.getRequest().getService().getDeploymentConfiguration() + .isProductionMode()) { + pushJS += ApplicationConstants.VAADIN_PUSH_JS; + } else { + pushJS += ApplicationConstants.VAADIN_PUSH_DEBUG_JS; + } + fragmentNodes.add(new Element(Tag.valueOf("script"), "").attr( - "type", "text/javascript").attr("src", - vaadinLocation + ApplicationConstants.VAADIN_PUSH_JS)); + "type", "text/javascript").attr("src", pushJS)); } String bootstrapLocation = vaadinLocation + "vaadinBootstrap.js"; diff --git a/shared/src/com/vaadin/shared/ApplicationConstants.java b/shared/src/com/vaadin/shared/ApplicationConstants.java index d7de435735..104f3047a8 100644 --- a/shared/src/com/vaadin/shared/ApplicationConstants.java +++ b/shared/src/com/vaadin/shared/ApplicationConstants.java @@ -78,6 +78,14 @@ public class ApplicationConstants implements Serializable { */ public static final String VAADIN_PUSH_JS = "vaadinPush.js"; + /** + * The name of the debug version of the javascript containing push support. + * The file is located in the VAADIN directory. + * + * @since 7.1.6 + */ + public static final String VAADIN_PUSH_DEBUG_JS = "vaadinPush.debug.js"; + /** * Name of the parameter used to transmit the CSRF token. */