Browse Source

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
tags/7.2.0.beta1
Johannes Dahlström 10 years ago
parent
commit
22214b0f24
1 changed files with 16 additions and 1 deletions
  1. 16
    1
      server/src/com/vaadin/server/Page.java

+ 16
- 1
server/src/com/vaadin/server/Page.java View File

@@ -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

Loading…
Cancel
Save