summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohannes Dahlström <johannes.dahlstrom@vaadin.com>2012-01-13 12:14:00 +0000
committerJohannes Dahlström <johannes.dahlstrom@vaadin.com>2012-01-13 12:14:00 +0000
commitf3f5f0ebff01df7aa22177629bbac45d4e157243 (patch)
tree1602975085c132926eef52a721deed9092331889 /src
parent62e3341e68278435984165ad10a07504a6ab949e (diff)
downloadvaadin-framework-f3f5f0ebff01df7aa22177629bbac45d4e157243.tar.gz
vaadin-framework-f3f5f0ebff01df7aa22177629bbac45d4e157243.zip
#8241 Rename Vaadin-Redirect to Vaadin-Refresh, make URI optional: if not given, refresh the current page
svn changeset:22625/svn branch:6.7
Diffstat (limited to 'src')
-rw-r--r--src/com/vaadin/terminal/gwt/client/ApplicationConnection.java22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
index 88f55bf24b..0bb311600c 100644
--- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
+++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
@@ -97,9 +97,9 @@ public class ApplicationConnection {
public static final String ATTRIBUTE_ERROR = "error";
/**
- * A string that, if found in a non-JSON response to a UIDL request,
- * followed by a colon, optional whitespace, and a URI, will cause the
- * browser to synchronously load the URI.
+ * A string that, if found in a non-JSON response to a UIDL request, will
+ * cause the browser to refresh the page. If followed by a colon, optional
+ * whitespace, and a URI, causes the browser to synchronously load the URI.
*
* <p>
* This allows, for instance, a servlet filter to redirect the application
@@ -110,12 +110,12 @@ public class ApplicationConnection {
* if (sessionExpired) {
* response.setHeader(&quot;Content-Type&quot;, &quot;text/html&quot;);
* response.getWriter().write(
- * myLoginPageHtml + &quot;&lt;!-- Vaadin-Redirect: &quot;
+ * myLoginPageHtml + &quot;&lt;!-- Vaadin-Refresh: &quot;
* + request.getContextPath() + &quot; --&gt;&quot;);
* }
* </pre>
*/
- public static final String UIDL_REDIRECT_TOKEN = "Vaadin-Redirect";
+ public static final String UIDL_REFRESH_TOKEN = "Vaadin-Refresh";
// will hold the UIDL security key (for XSS protection) once received
private String uidlSecurityKey = "init";
@@ -544,13 +544,15 @@ public class ApplicationConnection {
* the request and served non-UIDL content (for
* instance, a login page if the session has expired.)
* If the response contains a magic substring, do a
- * synchronous redirect to the given URI. See #8241
+ * synchronous refresh.
*/
- MatchResult redirectUri = RegExp.compile(
- UIDL_REDIRECT_TOKEN + ":\\s*(.*?)(\\s|$)")
+ MatchResult refreshToken = RegExp.compile(
+ UIDL_REFRESH_TOKEN + "(:\\s*(.*?))?(\\s|$)")
.exec(response.getText());
- if (redirectUri != null) {
- redirect(redirectUri.getGroup(1));
+ if (refreshToken != null) {
+ redirect(refreshToken.getGroup(2));
+ VConsole.log("*** REDIRECT : "
+ + refreshToken.getGroup(2));
return;
}
}