Browse Source

Wrap the atmosphere request instead of reusing an old request which might no longer be available (#11489)

Change-Id: I0623b056a657c341ec367d0249e5f66840119f87
tags/7.1.0.beta1
Artur Signell 11 years ago
parent
commit
3ee3b4926b

+ 6
- 17
server/src/com/vaadin/server/communication/PushHandler.java View File

@@ -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());
}

+ 2
- 2
server/src/com/vaadin/server/communication/PushRequestHandler.java View File

@@ -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();


Loading…
Cancel
Save