diff options
author | Artur Signell <artur@vaadin.com> | 2013-04-04 18:28:38 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2013-04-04 18:29:45 +0300 |
commit | 3ee3b4926b1af4409b32196ef290baf017b63379 (patch) | |
tree | b226ff53d81f41b1d8848c95eccd7cae029906c0 /server | |
parent | 1de6598dcf5958fe41490906308666718de5e8bd (diff) | |
download | vaadin-framework-3ee3b4926b1af4409b32196ef290baf017b63379.tar.gz vaadin-framework-3ee3b4926b1af4409b32196ef290baf017b63379.zip |
Wrap the atmosphere request instead of reusing an old request which might no longer be available (#11489)
Change-Id: I0623b056a657c341ec367d0249e5f66840119f87
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/server/communication/PushHandler.java | 23 | ||||
-rw-r--r-- | server/src/com/vaadin/server/communication/PushRequestHandler.java | 4 |
2 files changed, 8 insertions, 19 deletions
diff --git a/server/src/com/vaadin/server/communication/PushHandler.java b/server/src/com/vaadin/server/communication/PushHandler.java index 39481db46a..de4987a99a 100644 --- a/server/src/com/vaadin/server/communication/PushHandler.java +++ b/server/src/com/vaadin/server/communication/PushHandler.java @@ -30,8 +30,8 @@ import org.json.JSONException; import com.vaadin.server.LegacyCommunicationManager.InvalidUIDLSecurityKeyException; import com.vaadin.server.ServiceException; import com.vaadin.server.SessionExpiredException; -import com.vaadin.server.VaadinRequest; -import com.vaadin.server.VaadinService; +import com.vaadin.server.VaadinServletRequest; +import com.vaadin.server.VaadinServletService; import com.vaadin.server.VaadinSession; import com.vaadin.ui.UI; @@ -43,9 +43,9 @@ import com.vaadin.ui.UI; */ public class PushHandler implements AtmosphereHandler { - private VaadinService service; + private VaadinServletService service; - public PushHandler(VaadinService service) { + public PushHandler(VaadinServletService service) { this.service = service; } @@ -53,7 +53,8 @@ public class PushHandler implements AtmosphereHandler { public void onRequest(AtmosphereResource resource) { AtmosphereRequest req = resource.getRequest(); - VaadinRequest vaadinRequest = getVaadinRequest(req); + VaadinServletRequest vaadinRequest = new VaadinServletRequest(req, + service); VaadinSession session; try { @@ -166,18 +167,6 @@ public class PushHandler implements AtmosphereHandler { public void destroy() { } - private VaadinRequest getVaadinRequest(AtmosphereRequest req) { - while (req.getRequest() instanceof AtmosphereRequest) { - req = (AtmosphereRequest) req.getRequest(); - } - if (req.getRequest() instanceof VaadinRequest) { - return (VaadinRequest) req.getRequest(); - } else { - throw new IllegalArgumentException( - "Request does not wrap VaadinRequest"); - } - } - private static final Logger getLogger() { return Logger.getLogger(PushHandler.class.getName()); } diff --git a/server/src/com/vaadin/server/communication/PushRequestHandler.java b/server/src/com/vaadin/server/communication/PushRequestHandler.java index 10ef16e11c..4f56c0b6a3 100644 --- a/server/src/com/vaadin/server/communication/PushRequestHandler.java +++ b/server/src/com/vaadin/server/communication/PushRequestHandler.java @@ -29,9 +29,9 @@ import com.vaadin.server.RequestHandler; import com.vaadin.server.ServletPortletHelper; import com.vaadin.server.VaadinRequest; import com.vaadin.server.VaadinResponse; -import com.vaadin.server.VaadinService; import com.vaadin.server.VaadinServletRequest; import com.vaadin.server.VaadinServletResponse; +import com.vaadin.server.VaadinServletService; import com.vaadin.server.VaadinSession; /** @@ -47,7 +47,7 @@ public class PushRequestHandler implements RequestHandler { private AtmosphereFramework atmosphere; private PushHandler pushHandler; - public PushRequestHandler(VaadinService service) { + public PushRequestHandler(VaadinServletService service) { atmosphere = new AtmosphereFramework(); |