diff options
author | Automerge <automerge@vaadin.com> | 2012-04-20 13:07:11 +0000 |
---|---|---|
committer | Automerge <automerge@vaadin.com> | 2012-04-20 13:07:11 +0000 |
commit | 14c4453d28cce7a61dae1bc118cdf5c4cf7e7ab4 (patch) | |
tree | 05b9cdb0923051e7452957de590871bb6c3b3825 /src/com/vaadin | |
parent | 1abcab4585409df811fd2f93840bcab686a9d5a6 (diff) | |
download | vaadin-framework-14c4453d28cce7a61dae1bc118cdf5c4cf7e7ab4.tar.gz vaadin-framework-14c4453d28cce7a61dae1bc118cdf5c4cf7e7ab4.zip |
[merge from 6.7] #8407 Handle the case of a 503 response without a Retry-After header
svn changeset:23603/svn branch:6.8
Diffstat (limited to 'src/com/vaadin')
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ApplicationConnection.java | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java index 0603e80c93..82971860b5 100644 --- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java +++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java @@ -524,21 +524,26 @@ public class ApplicationConnection { return; case 503: - // We'll assume msec instead of the usual seconds - int delay = Integer.parseInt(response - .getHeader("Retry-After")); - VConsole.log("503, retrying in " + delay + "msec"); - (new Timer() { - @Override - public void run() { - // TODO why? Here used to be "activeRequests--;" - // but can't see why exactly - hasActiveRequest = false; - doUidlRequest(uri, payload, synchronous); - } - }).schedule(delay); - return; - + /* + * We'll assume msec instead of the usual seconds. If + * there's no Retry-After header, handle the error like + * a 500, as per RFC 2616 section 10.5.4. + */ + String delay = response.getHeader("Retry-After"); + if (delay != null) { + VConsole.log("503, retrying in " + delay + "msec"); + (new Timer() { + @Override + public void run() { + // TODO why? Here used to be + // "activeRequests--;" + // but can't see why exactly + hasActiveRequest = false; + doUidlRequest(uri, payload, synchronous); + } + }).schedule(Integer.parseInt(delay)); + return; + } } if ((statusCode / 100) == 4) { @@ -549,6 +554,13 @@ public class ApplicationConnection { + statusCode, statusCode); endRequest(); return; + } else if ((statusCode / 100) == 5) { + // Something's wrong on the server, there's nothing the + // client can do except maybe try again. + showCommunicationError("Server error. Error code: " + + statusCode, statusCode); + endRequest(); + return; } String contentType = response.getHeader("Content-Type"); |