diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2014-01-30 17:06:33 +0200 |
---|---|---|
committer | Johannes Dahlström <johannesd@vaadin.com> | 2014-03-26 16:15:59 +0200 |
commit | 22214b0f24612cc80288b8e8471ff555aafcbc6e (patch) | |
tree | f0328544154e732eee7282b0d5d78cd204a71147 /server | |
parent | c364912a86c5ffd236d78d38c843fcf8e5959262 (diff) | |
download | vaadin-framework-22214b0f24612cc80288b8e8471ff555aafcbc6e.tar.gz vaadin-framework-22214b0f24612cc80288b8e8471ff555aafcbc6e.zip |
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
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/server/Page.java | 17 |
1 files changed, 16 insertions, 1 deletions
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. + * <p> + * 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. + * <p> + * 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 |