]> source.dussan.org Git - vaadin-framework.git/commitdiff
Omit timings in production mode (#19644)
authorHenri Sara <hesara@vaadin.com>
Tue, 1 Mar 2016 12:00:23 +0000 (14:00 +0200)
committerVaadin Code Review <review@vaadin.com>
Tue, 1 Mar 2016 14:02:57 +0000 (14:02 +0000)
* UIDL responses only include server side timing information when not
in production mode.
* Update documentation accordingly.

Change-Id: I961d1fdc96b3d04f22254fcd13a5412f17118b42

WebContent/release-notes.html
client/src/com/vaadin/client/ApplicationConnection.java
documentation/advanced/advanced-debug.asciidoc
server/src/com/vaadin/server/communication/UidlWriter.java

index f7b5611be5baaa9e2dd8ae016edb2daccd33ae7b..fc1d69fd245bb21c70a059529928c46682f5bb7d 100644 (file)
                 This default can be changed in deployment configuration.</li>
             <li>The annotations @PreserveOnRefresh, @Push, @Theme, @Title, @VaadinServletConfiguration and @Widgetset now use
                 @Inherited. The annotation is also looked up in extended interfaces for backwards compatibility.</li>
+            <li>Server-side timings of request processing are only sent to the client when not in production mode. Using the
+                timings in TestBench tests requires the server not to be in production mode.</li>
         </ul>
         <h3 id="knownissues">Known Issues and Limitations</h3>
         <ul>
index ce55c13ce5fe370e99df234641c7da3897a57c81..6830f21bcd4ec3e5a232ee050d9a0aea2c90aeb2 100644 (file)
@@ -491,7 +491,11 @@ public class ApplicationConnection implements HasHandlers {
                 smh.@com.vaadin.client.communication.MessageHandler::lastProcessingTime,
                     smh.@com.vaadin.client.communication.MessageHandler::totalProcessingTime
                 ];
-            pd = pd.concat(smh.@com.vaadin.client.communication.MessageHandler::serverTimingInfo);
+            if (null != smh.@com.vaadin.client.communication.MessageHandler::serverTimingInfo) {
+                pd = pd.concat(smh.@com.vaadin.client.communication.MessageHandler::serverTimingInfo);
+            } else {
+                pd = pd.concat(-1, -1);
+            }
             pd[pd.length] = smh.@com.vaadin.client.communication.MessageHandler::bootstrapTime;
             return pd;
         });
index 9a0d8d7ba8bd195346e089baf920cddc400a817e..9731c650afa3dde0d1826552295466628d85b827 100644 (file)
@@ -14,14 +14,20 @@ debug features for Vaadin developers:
 * Debug Window
 * Display debug information in the Debug Window and server console
 * On-the-fly compilation of Sass themes
+* Timings of server calls for Vaadin TestBench
+
+It is recommended to always deploy production applications in production mode
+for security reasons.
 
 [[advanced.debug.mode]]
 == Enabling the Debug Mode
 
 The debug mode is enabled and production mode disabled by default in the UI
-templates created with the Eclipse plugin or the Maven archetypes. The debug
-mode can be enabled by giving a [parameter]#productionMode=false# parameter to
-the Vaadin servlet configuration:
+templates created with the Eclipse plugin or the Maven archetypes. Some
+archetypes have a separate module and profile for producing a production mode
+application. The debug mode can be enabled by giving a
+[parameter]#productionMode=false# parameter to the Vaadin servlet
+configuration:
 
 [subs="normal"]
 ----
index b117cb4b4d7cbd3873eed1e5edb80bbeab99382e..8a4e62fb24bc5fae162295c7c01906c92115b58e 100644 (file)
@@ -352,9 +352,12 @@ public class UidlWriter implements Serializable {
      * @throws IOException
      */
     private void writePerformanceData(UI ui, Writer writer) throws IOException {
-        writer.write(String.format(", \"timings\":[%d, %d]", ui.getSession()
-                .getCumulativeRequestDuration(), ui.getSession()
-                .getLastRequestDuration()));
+        if (!ui.getSession().getService().getDeploymentConfiguration()
+                .isProductionMode()) {
+            writer.write(String.format(", \"timings\":[%d, %d]", ui
+                    .getSession().getCumulativeRequestDuration(), ui
+                    .getSession().getLastRequestDuration()));
+        }
     }
 
     private static final Logger getLogger() {