public static final String ATTRIBUTE_ERROR = "error";
/**
- * 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.
+ * 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.
*
* <p>
* This allows, for instance, a servlet filter to redirect the application
* if (sessionExpired) {
* response.setHeader("Content-Type", "text/html");
* response.getWriter().write(
- * myLoginPageHtml + "<!-- Vaadin-Refresh: "
+ * myLoginPageHtml + "<!-- Vaadin-Redirect: "
* + request.getContextPath() + " -->");
* }
* </pre>
*/
- public static final String UIDL_REFRESH_TOKEN = "Vaadin-Refresh";
+ public static final String UIDL_REDIRECT_TOKEN = "Vaadin-Redirect";
// will hold the UIDL security key (for XSS protection) once received
private String uidlSecurityKey = "init";
* 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 refresh. See #8241.
+ * synchronous redirect to the given URI. See #8241
*/
- MatchResult refreshToken = RegExp.compile(
- UIDL_REFRESH_TOKEN + "(:\\s*(.*?))?(\\s|$)")
+ MatchResult redirectUri = RegExp.compile(
+ UIDL_REDIRECT_TOKEN + ":\\s*(.*?)(\\s|$)")
.exec(response.getText());
- if (refreshToken != null) {
- redirect(refreshToken.getGroup(2));
+ if (redirectUri != null) {
+ redirect(redirectUri.getGroup(1));
return;
}
}