diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2013-04-12 14:31:49 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-04-15 09:19:01 +0000 |
commit | c030e9d2d102a5d3cfd3b63f177495c619bf8b72 (patch) | |
tree | d0bb2562b1da30ff160b98ddc96a0bc7be6d5619 /server | |
parent | eed51a5d58d4318816f1c0f13cc19c9b4e91731c (diff) | |
download | vaadin-framework-c030e9d2d102a5d3cfd3b63f177495c619bf8b72.tar.gz vaadin-framework-c030e9d2d102a5d3cfd3b63f177495c619bf8b72.zip |
Add isPushRequest() check to VaadinServletService.isOtherRequest() (#11556)
* Prevents VaadinService from creating a new session for push requests
* Also unify behaviour when UI is not found in session (log and return)
Change-Id: Iea0e4ae5e0b5fa81404f688aa6d92d16343ebd26
Diffstat (limited to 'server')
4 files changed, 13 insertions, 13 deletions
diff --git a/server/src/com/vaadin/server/VaadinServletService.java b/server/src/com/vaadin/server/VaadinServletService.java index ba78efa9bb..4ae70c1c3b 100644 --- a/server/src/com/vaadin/server/VaadinServletService.java +++ b/server/src/com/vaadin/server/VaadinServletService.java @@ -190,8 +190,9 @@ public class VaadinServletService extends VaadinService { && !ServletUIInitHandler.isUIInitRequest(request) && !ServletPortletHelper.isFileUploadRequest(request) && !ServletPortletHelper.isHeartbeatRequest(request) - && !ServletPortletHelper.isPublishedFileRequest(request) && !ServletPortletHelper - .isUIDLRequest(request)); + && !ServletPortletHelper.isPublishedFileRequest(request) + && !ServletPortletHelper.isUIDLRequest(request) && !ServletPortletHelper + .isPushRequest(request)); } @Override diff --git a/server/src/com/vaadin/server/communication/PushHandler.java b/server/src/com/vaadin/server/communication/PushHandler.java index b2994d547f..15da4c3707 100644 --- a/server/src/com/vaadin/server/communication/PushHandler.java +++ b/server/src/com/vaadin/server/communication/PushHandler.java @@ -82,7 +82,10 @@ public class PushHandler implements AtmosphereHandler { try { UI ui = service.findUI(vaadinRequest); if (ui == null) { - throw new RuntimeException("UI not found!"); + // This should not happen + getLogger().warning( + "Could not find the requested UI in session"); + return; } assert ui.getPushConnection() instanceof AtmospherePushConnection; AtmospherePushConnection connection = (AtmospherePushConnection) ui diff --git a/server/src/com/vaadin/server/communication/ServerRpcHandler.java b/server/src/com/vaadin/server/communication/ServerRpcHandler.java index da146abe3f..6f67cee680 100644 --- a/server/src/com/vaadin/server/communication/ServerRpcHandler.java +++ b/server/src/com/vaadin/server/communication/ServerRpcHandler.java @@ -77,7 +77,7 @@ public class ServerRpcHandler implements Serializable { * variable changes) and executes the calls. * * @param ui - * The {@link UI} receiving the calls. + * The {@link UI} receiving the calls. Cannot be null. * @param reader * The {@link Reader} used to read the JSON. * @param request @@ -91,15 +91,6 @@ public class ServerRpcHandler implements Serializable { */ public void handleRpc(UI ui, Reader reader, VaadinRequest request) throws IOException, InvalidUIDLSecurityKeyException, JSONException { - - // Verify that there's an UI - if (ui == null) { - // This should not happen, no windows exists but - // session is still open. - getLogger().warning("Could not get UI for session"); - return; - } - ui.getSession().setLastRequestTimestamp(System.currentTimeMillis()); // Change all variables based on request parameters diff --git a/server/src/com/vaadin/server/communication/UidlRequestHandler.java b/server/src/com/vaadin/server/communication/UidlRequestHandler.java index 32f9df3eff..ef627a818b 100644 --- a/server/src/com/vaadin/server/communication/UidlRequestHandler.java +++ b/server/src/com/vaadin/server/communication/UidlRequestHandler.java @@ -69,6 +69,11 @@ public class UidlRequestHandler extends SynchronizedRequestHandler { return false; } UI uI = session.getService().findUI(request); + if (uI == null) { + // This should not happen + getLogger().warning("Could not find the requested UI in session"); + return true; + } checkWidgetsetVersion(request); String requestThemeName = request.getParameter("theme"); |