summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2012-09-12 11:16:40 +0300
committerJohannes Dahlström <johannesd@vaadin.com>2012-09-12 11:17:19 +0300
commit008cd38ff9dd1f05304409723332bbfc0eb49e58 (patch)
treef7aef7446568a8da26ecdbeed2ae8f7cd1b3559f
parent8e81fddf7337916adef3d78be72a42efa312ddce (diff)
downloadvaadin-framework-008cd38ff9dd1f05304409723332bbfc0eb49e58.tar.gz
vaadin-framework-008cd38ff9dd1f05304409723332bbfc0eb49e58.zip
Don't try to redirect browser on failed heartbeat requests
-rw-r--r--server/src/com/vaadin/server/VaadinServlet.java29
1 files changed, 19 insertions, 10 deletions
diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java
index c4173e1271..9372a08e10 100644
--- a/server/src/com/vaadin/server/VaadinServlet.java
+++ b/server/src/com/vaadin/server/VaadinServlet.java
@@ -825,11 +825,8 @@ public class VaadinServlet extends HttpServlet implements Constants {
try {
SystemMessages ci = getVaadinService().getSystemMessages();
- if (getRequestType(request) != RequestType.UIDL) {
- // 'plain' http req - e.g. browser reload;
- // just go ahead redirect the browser
- response.sendRedirect(ci.getSessionExpiredURL());
- } else {
+ RequestType requestType = getRequestType(request);
+ if (requestType == RequestType.UIDL) {
/*
* Invalidate session (weird to have session if we're saying
* that it's expired, and worse: portal integration will fail
@@ -846,6 +843,13 @@ public class VaadinServlet extends HttpServlet implements Constants {
ci.getSessionExpiredMessage(), null,
ci.getSessionExpiredURL());
+ } else if (requestType == RequestType.HEARTBEAT) {
+ response.sendError(HttpServletResponse.SC_GONE,
+ "Session expired");
+ } else {
+ // 'plain' http req - e.g. browser reload;
+ // just go ahead redirect the browser
+ response.sendRedirect(ci.getSessionExpiredURL());
}
} catch (SystemMessageException ee) {
throw new ServletException(ee);
@@ -867,11 +871,8 @@ public class VaadinServlet extends HttpServlet implements Constants {
try {
SystemMessages ci = getVaadinService().getSystemMessages();
- if (getRequestType(request) != RequestType.UIDL) {
- // 'plain' http req - e.g. browser reload;
- // just go ahead redirect the browser
- response.sendRedirect(ci.getCommunicationErrorURL());
- } else {
+ RequestType requestType = getRequestType(request);
+ if (requestType == RequestType.UIDL) {
// send uidl redirect
criticalNotification(request, response,
ci.getCommunicationErrorCaption(),
@@ -882,6 +883,14 @@ public class VaadinServlet extends HttpServlet implements Constants {
* since the session is not created by the portal.
*/
request.getSession().invalidate();
+
+ } else if (requestType == RequestType.HEARTBEAT) {
+ response.sendError(HttpServletResponse.SC_FORBIDDEN,
+ "Forbidden");
+ } else {
+ // 'plain' http req - e.g. browser reload;
+ // just go ahead redirect the browser
+ response.sendRedirect(ci.getCommunicationErrorURL());
}
} catch (SystemMessageException ee) {
throw new ServletException(ee);