Server push (long polling)In my application does not work .I use the official vaddin-spring add-on ,and my app is based on springBoot.
After deeply debuging vaadin’s code,I found the bug:
Vaadin framework integrates Atmosphere Framework to support push ,when the vaadin UI is inited ,the client will send a push request to the server:
http://localhost:8080/deeryo/vaadinServlet/PUSH?v-uiId=1&v-csrfToken=395f908b-73ad-44b9-8995-18678deb9cc1&X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.2.13.vaadin3-jquery&X-Atmosphere-Transport=long-polling&
X-Atmosphere-TrackMessageSize=true&Content-Type=application%2Fjson%3B%20charset%3DUTF-8&X-atmo-protocol=true&_=1468289101510
but Atmosphere Framework determine the PushMode from reqeust header ,but not from the request query parameter.the code is:
AtmosphereResourceImpl.java
private TRANSPORT configureTransport() {
if (req == null) return UNDEFINED;
String s = req.getHeader(HeaderConfig.X_ATMOSPHERE_TRANSPORT);
if (s == null) return UNDEFINED;
if (s.equals(UNDEFINED.name()) && Utils.rawWebSocket(req)) {
return TRANSPORT.WEBSOCKET;
}
s = s.replace("-", "_").toUpperCase();
if (TRANSPORT.POLLING.name().equals(s)) {
return TRANSPORT.POLLING;
} else if (TRANSPORT.LONG_POLLING.name().equals(s)) {
return TRANSPORT.LONG_POLLING;
} else if (TRANSPORT.STREAMING.name().equals(s)) {
return TRANSPORT.STREAMING;
} else if (TRANSPORT.JSONP.name().equals(s)) {
return TRANSPORT.JSONP;
} else if (TRANSPORT.WEBSOCKET.name().equals(s)) {
return TRANSPORT.WEBSOCKET;
} else if (TRANSPORT.SSE.name().equals(s)) {
return TRANSPORT.SSE;
} else if (TRANSPORT.AJAX.name().equals(s)) {
return TRANSPORT.AJAX;
} else if (TRANSPORT.CLOSE.name().equals(s)) {
return TRANSPORT.CLOSE;
} else {
return UNDEFINED;
}
}
as a result, the transport is UNDEFINDE !!! So,my push(long-polling) can’t work.