summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2016-03-01 14:00:23 +0200
committerVaadin Code Review <review@vaadin.com>2016-03-01 14:02:57 +0000
commit05003bafeb84f8251db6168746893e27bb3b0138 (patch)
tree91e8f9ce890c05cf4c038381e9312972854e4f3a
parent81aadbb9edeb4a57dd02c35937905e5427a674e0 (diff)
downloadvaadin-framework-05003bafeb84f8251db6168746893e27bb3b0138.tar.gz
vaadin-framework-05003bafeb84f8251db6168746893e27bb3b0138.zip
Omit timings in production mode (#19644)
* UIDL responses only include server side timing information when not in production mode. * Update documentation accordingly. Change-Id: I961d1fdc96b3d04f22254fcd13a5412f17118b42
-rw-r--r--WebContent/release-notes.html2
-rw-r--r--client/src/com/vaadin/client/ApplicationConnection.java6
-rw-r--r--documentation/advanced/advanced-debug.asciidoc12
-rw-r--r--server/src/com/vaadin/server/communication/UidlWriter.java9
4 files changed, 22 insertions, 7 deletions
diff --git a/WebContent/release-notes.html b/WebContent/release-notes.html
index f7b5611be5..fc1d69fd24 100644
--- a/WebContent/release-notes.html
+++ b/WebContent/release-notes.html
@@ -142,6 +142,8 @@
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>
diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java
index ce55c13ce5..6830f21bcd 100644
--- a/client/src/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/com/vaadin/client/ApplicationConnection.java
@@ -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;
});
diff --git a/documentation/advanced/advanced-debug.asciidoc b/documentation/advanced/advanced-debug.asciidoc
index 9a0d8d7ba8..9731c650af 100644
--- a/documentation/advanced/advanced-debug.asciidoc
+++ b/documentation/advanced/advanced-debug.asciidoc
@@ -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"]
----
diff --git a/server/src/com/vaadin/server/communication/UidlWriter.java b/server/src/com/vaadin/server/communication/UidlWriter.java
index b117cb4b4d..8a4e62fb24 100644
--- a/server/src/com/vaadin/server/communication/UidlWriter.java
+++ b/server/src/com/vaadin/server/communication/UidlWriter.java
@@ -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() {