From: Marc Englund Date: Tue, 8 Sep 2009 12:08:17 +0000 (+0000) Subject: Made error notifications overrideable; final commit for #2835 X-Git-Tag: 6.7.0.beta1~2494 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=af3f05f607e7d9c39189432e4b4523faf24badd0;p=vaadin-framework.git Made error notifications overrideable; final commit for #2835 svn changeset:8710/svn branch:6.1 --- diff --git a/src/com/vaadin/terminal/gwt/server/GAEApplicationServlet.java b/src/com/vaadin/terminal/gwt/server/GAEApplicationServlet.java index 147fb63f57..daab5fbbc4 100644 --- a/src/com/vaadin/terminal/gwt/server/GAEApplicationServlet.java +++ b/src/com/vaadin/terminal/gwt/server/GAEApplicationServlet.java @@ -48,6 +48,27 @@ public class GAEApplicationServlet extends ApplicationServlet { private static final String PROPERTY_EXPIRES = "expires"; private static final String PROPERTY_DATA = "data"; + protected void sendDeadlineExceededNotification(HttpServletRequest request, + HttpServletResponse response) throws IOException { + criticalNotification( + request, + response, + "Deadline Exceeded", + "I'm sorry, but the operation took too long to complete. We'll try reloading to see where we're at, please take note of any unsaved data...", + "", null); + } + + protected void sendNotSerializableNotification(HttpServletRequest request, + HttpServletResponse response) throws IOException { + criticalNotification( + request, + response, + "NotSerializableException", + "I'm sorry, but there seems to be a serious problem, please contact the administrator. And please take note of any unsaved data...", + "", getApplicationUrl(request).toString() + + "?restartApplication"); + } + @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { @@ -142,24 +163,11 @@ public class GAEApplicationServlet extends ApplicationServlet { } catch (DeadlineExceededException e) { System.err.println("DeadlineExceeded for " + session.getId()); - // TODO i18n? - criticalNotification( - request, - response, - "Deadline Exceeded", - "I'm sorry, but the operation took too long to complete. We'll try reloading to see where we're at, please take note of any unsaved data...", - "", null); + sendDeadlineExceededNotification(request, response); } catch (NotSerializableException e) { - // TODO i18n? - // TODO this notification is not shown - solve this in some other - // way... - criticalNotification( - request, - response, - "NotSerializableException", - "I'm sorry, but there seems to be a serious problem, please contact the administrator. And please take note of any unsaved data...", - "", getApplicationUrl(request).toString() - + "?restartApplication"); + // TODO this notification is usually not shown - should we redirect + // in some other way - can we? + sendNotSerializableNotification(request, response); e.printStackTrace(System.err); } finally { // "Next, please!" @@ -170,8 +178,8 @@ public class GAEApplicationServlet extends ApplicationServlet { } } - ApplicationContext getApplicationContext(HttpServletRequest request, - MemcacheService memcache) { + protected ApplicationContext getApplicationContext( + HttpServletRequest request, MemcacheService memcache) { HttpSession session = request.getSession(); String id = AC_BASE + session.getId(); byte[] serializedAC = (byte[]) memcache.get(id);