From 22214b0f24612cc80288b8e8471ff555aafcbc6e Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Thu, 30 Jan 2014 17:06:33 +0200 Subject: Use window name "_self" with Page.setLocation (#12925) This signals the client side to stop running so it will not eg. flash a "session expired" dialog sent via push just before the browser navigates away (see #12298). setLocation should thus not be used to start downloads anymore. Change-Id: Id11e4b4fe6ee93e3ac267879f8faa52c43b9c301 --- server/src/com/vaadin/server/Page.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'server/src') diff --git a/server/src/com/vaadin/server/Page.java b/server/src/com/vaadin/server/Page.java index 19b84381d5..3b96ec2ee1 100644 --- a/server/src/com/vaadin/server/Page.java +++ b/server/src/com/vaadin/server/Page.java @@ -868,18 +868,33 @@ public class Page implements Serializable { /** * Navigates this page to the given URI. The contents of this page in the * browser is replaced with whatever is returned for the given URI. + *

+ * This method should not be used to start downloads, as the client side + * will assume the browser will navigate away when opening the URI. Use one + * of the {@code Page.open} methods or {@code FileDownloader} instead. + * + * @see #open(String, String) + * @see FileDownloader * * @param uri * the URI to show */ public void setLocation(String uri) { - openList.add(new OpenResource(uri, null, -1, -1, BORDER_DEFAULT, false)); + openList.add(new OpenResource(uri, "_self", -1, -1, BORDER_DEFAULT, + false)); uI.markAsDirty(); } /** * Navigates this page to the given URI. The contents of this page in the * browser is replaced with whatever is returned for the given URI. + *

+ * This method should not be used to start downloads, as the client side + * will assume the browser will navigate away when opening the URI. Use one + * of the {@code Page.open} methods or {@code FileDownloader} instead. + * + * @see #open(String, String) + * @see FileDownloader * * @param uri * the URI to show -- cgit v1.2.3