开发者

Java library suggestions for implementing a custom web server [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
开发者_开发技巧

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed last month.

Improve this question

I would like to create a web server that will serve/accept json files through REST. The JSON files being served will come from a database query and format the results into JSON. Any suggestions for a good java library. I have tried using Apache HTTPComponents. While maybe I can just create a servlet but I am not really allowed to install a servlet container in the server machine.

EDIT: I was just thinking to create the program where I can just simply issue a simple java -jar Application.jar and everything is already started and functional. The application will listen on a certain port of the machine and respond to some requests from browser and/or another java program. Looks like Jetty will help me do it. As I have said, I have implemented something using HTTPComponents and I'm just simply parsing the URL from the requests and do something in the server based on the parsed URL.


I'm a huge fan of the venerable Jetty. It's small and straightforward. It's technically a servlet container (it's more thought of an embedded HTTP server), but you can embed it within your own app. It also supports Java REST libraries such as Jersey


CXF is a fantastic web services library. It has built-in support for REST, but I haven't tried that particular feature myself. CXF uses Jetty by default, but it's designed to be easily adaptable to Tomcat or other servlet containers.


I would suggest having a look at:

  • JBoss Netty
  • Jetty

What I like about them:

  • Both of you can be run embedded (as jar).
  • They also both support an "asynchronous event-driven"/NIO architecture. Jetty has continuations for this. NIO is the new way of handling IO and has the ability to scale better.


You might want to have a look at Restlet: Restlet Tutorial


Check out Grizzly project


Do you really need all the overhead and complexity of a web server? It sounds like all you really need is a socket listener.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜