UnitedSince88
UnitedSince88

Reputation: 23

Apache Tomcat Websockets implementing fallback

Whenever there is a doGet or a doPost overridden the sockets don't work properly.

One can get it to work by removing both the above functions.

Problem : I am giving support on IE9. So as a back up mechanism I am going back to polling which makes a POST or GET request. Now as the same WebSocketServlet doesnt have a doGet and doPost, I am not sure what to do. HELP ?

Does Jetty WebSockets have the same problem ?

Upvotes: 0

Views: 270

Answers (2)

anna
anna

Reputation: 26

I think it is sufficient to call super.doGet(req, resp) from your own doGet, as this is the method that takes care of setting up the websocket (check the source code of org.apache.catalina.websocket.WebSocketServlet).

This worked out just fine for my case, I'm using tomcat-7.0.42.

Upvotes: 1

Martin
Martin

Reputation: 3058

Well,

Why not just create two separate Servlets? It doesn't make much sense to mix the code, if you have two separate components, you can still call the WebSocketServlet for normal cases, and if you detect IE9, call the other servlet that supports your polling mechanism.

Regards

Upvotes: 0

Related Questions