summaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/terminal/gwt/server
diff options
context:
space:
mode:
authorMarc Englund <marc.englund@itmill.com>2009-01-23 09:48:33 +0000
committerMarc Englund <marc.englund@itmill.com>2009-01-23 09:48:33 +0000
commitc60ca65f8f941fe3d80317747f5dc4f41c0e70d6 (patch)
tree441a360960bf623c8940341909c0fd68e3b34d69 /src/com/itmill/toolkit/terminal/gwt/server
parent58507aa78d79200fa9b858395daf280e00c5e86d (diff)
downloadvaadin-framework-c60ca65f8f941fe3d80317747f5dc4f41c0e70d6.tar.gz
vaadin-framework-c60ca65f8f941fe3d80317747f5dc4f41c0e70d6.zip
Added a communication error system-message that is written to the client when the initial page is rendered. If any UIDL request fails, the message is shown. Fixes [2485]
svn changeset:6624/svn branch:trunk
Diffstat (limited to 'src/com/itmill/toolkit/terminal/gwt/server')
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java53
1 files changed, 50 insertions, 3 deletions
diff --git a/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java b/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java
index d442b1ed17..471ef2877e 100644
--- a/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java
+++ b/src/com/itmill/toolkit/terminal/gwt/server/ApplicationServlet.java
@@ -784,7 +784,8 @@ public class ApplicationServlet extends HttpServlet {
*/
private void writeAjaxPage(HttpServletRequest request,
HttpServletResponse response, Window window, String themeName,
- Application application) throws IOException, MalformedURLException {
+ Application application) throws IOException, MalformedURLException,
+ ServletException {
// e.g portlets only want a html fragment
boolean fragment = (request.getAttribute(REQUEST_FRAGMENT) != null);
@@ -885,6 +886,15 @@ public class ApplicationServlet extends HttpServlet {
// but indicates that it should not be used in CSS and such:
appId = appId + appId.hashCode();
+ // Get system messages
+ Application.SystemMessages systemMessages = null;
+ try {
+ systemMessages = getSystemMessages();
+ } catch (SystemMessageException e) {
+ // failing to get the system messages is always a problem
+ throw new ServletException("CommunicationError!", e);
+ }
+
if (isGecko17(request)) {
// special start page for gecko 1.7 versions. Firefox 1.0 is not
// supported, but the hack is make it possible to use linux and
@@ -923,7 +933,25 @@ public class ApplicationServlet extends HttpServlet {
page.write(VERSION);
page.write("\",applicationVersion:\"");
page.write(application.getVersion());
- page.write("\"}");
+ page.write("\"},");
+ if (systemMessages != null) {
+ // Write the CommunicationError -message to client
+ String caption = systemMessages.getCommunicationErrorCaption();
+ if (caption != null) {
+ caption = "\"" + caption + "\"";
+ }
+ String message = systemMessages.getCommunicationErrorMessage();
+ if (message != null) {
+ message = "\"" + message + "\"";
+ }
+ String url = systemMessages.getCommunicationErrorURL();
+ if (url != null) {
+ url = "\"" + url + "\"";
+ }
+ page.write("\"comErrMsg\": {" + "\"caption\":" + caption + ","
+ + "\"message\" : " + message + "," + "\"url\" : " + url
+ + "}");
+ }
page.write("};\n//]]>\n</script>\n");
if (themeName != null) {
@@ -978,7 +1006,26 @@ public class ApplicationServlet extends HttpServlet {
page.write(VERSION);
page.write("\",applicationVersion:\"");
page.write(application.getVersion());
- page.write("\"}");
+ page.write("\"},");
+ if (systemMessages != null) {
+ // Write the CommunicationError -message to client
+ String caption = systemMessages.getCommunicationErrorCaption();
+ if (caption != null) {
+ caption = "\"" + caption + "\"";
+ }
+ String message = systemMessages.getCommunicationErrorMessage();
+ if (message != null) {
+ message = "\"" + message + "\"";
+ }
+ String url = systemMessages.getCommunicationErrorURL();
+ if (url != null) {
+ url = "\"" + url + "\"";
+ }
+
+ page.write("\"comErrMsg\": {" + "\"caption\":" + caption + ","
+ + "\"message\" : " + message + "," + "\"url\" : " + url
+ + "}");
+ }
page.write("};\n//]]>\n</script>\n");
if (themeName != null) {