A Java HTTP Server

后端 未结 10 2016
轮回少年
轮回少年 2021-01-03 08:59

I want to implement a Java HTTP server locally, I mean the server computer would be in my control. I\'m expecting not more than 20 clients to send requests to it. I was wond

10条回答
  •  臣服心动
    2021-01-03 09:00

    Seriously, reuse an existing solution. Why the hell are you even thinking rolling your own?

    Now, 1. I don't understand your question as being about embedding a container. 2. You mentioned long polling several time. So I'd suggest to use GlassFish v3 / Grizzly (because there are many samples, e.g. have a look at the Dead Simple Comet Example on Glassfish v3 / Grizzly).

    If you don't want to rely on the way a container implemented Comet support, use atmosphere and any of the container mentioned on the web site:

    Atmosphere is a POJO based framework using Inversion of Control (IoC) to bring push/Comet to the masses! Finally a framework which can run on any Java based Web Server, including Google App Engine, Tomcat, Jetty, GlassFish, Weblogic, Grizzly, JBossWeb and JBoss, Resin, etc. without having to wait for Servlet 3.0 Async support or without the needs to learn how Comet support has been differently implemented by all those Containers.

    If this is not a concern, just stick with the suggested option (GlassFish v3 / Grizzly).

    For a concrete and recent comparison between Comet server implementation, checkout this awesome Comet Maturity comparison grid view (source: Comet Gazing: Maturity). It might help you to make your final choice... or not :)

提交回复
热议问题