简体   繁体   中英

JavaEE 6 Servlet for long polling

I've tried to create async-servlet for long-polling, using this tutorial on my Glassfish server, however it didn't work well, the POST requests were too long (timed out) and GET returned sometimes void response with "Error parsing XML file" firebug message. Can somebody please provide simple async-servlet for handling long-polling requests?

It is better you move away from the servlet based approach if you want to implement a long polling solution. Netty is very good choice for such applications. Just build a simple HTTP instance with child.keepAlive option in bootstrap kept to true (server doesnt close off the client connections). That way you don't need to deal with the servlet containers time out and connection handling intricacies. Netty is an asynchronous IO framework and should give you great performance matrix.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM