HTTP Server is the modern way to provide Web Experience. However, Tomcat, Weblogic server and so on, are somehow weighted, especially for java utility application,
Many open source Web Server can be founded from http://java-source.net/open-source/web-servers. There are three light embedded Http Servers that maybe you can choose to embedded in your application.
· Nano: The smallest http server
Free, simple, tiny (1 java file!), nicely embeddable HTTP server in Java. It can provide some basis Http function.
http://nanoserver.sourceforge.net/
· Jetty: (Embedded)
Jetty is a 100% Java HTTP Server and Servlet Container. This means that you do not need to configure and run a separate web server (like Apache) in order to use java, servlets and JSPs to generate dynamic content. Jetty is a fully featured web server for static and dynamic content. Unlike separate server/container solutions, this means that your web server and web application run in the same process, without interconnection overheads and complications. Furthermore, as a pure java component, Jetty can be simply included in your application for demonstration, distribution or deployment. Jetty is available on all Java supported platforms. To use Embedding Jetty, there is simple tutorial for reference: http://wiki.eclipse.org/Jetty/Tutorial/Embedding_Jetty
· JDK 1.6 Http Server:
JDK 6.0 shipped a simple, but extendable Http Server by using class com.sun.net.httpserver.HttpServer. IBM developerworks site provides a easy steps on how to use this Http Server (Chinese) http://www.ibm.com/developerworks/cn/java/j-lo-jse62/index.html
|
| Size | Functionality | Support Servlet API | Extendibility | Configurable |
| Nano | Tiny (1 File) | Limited | No | Difficulty | No |
| Jetty (Embedded) | Middle | Rich Function | Yes | Flexible and extensible | Yes (XML Supported) |
| JDK 1.6 Http Server | Embedded in JRE | Basic | No | Medium | No |
Any more light weight and good Http servers please add.
本文介绍了适用于Java实用程序应用的三种轻量级Http Server:Nano Server,Embedded Jetty和JDK 1.6自带的Http Server。Nano Server是最小的HTTP服务器,Jetty是一款功能齐全的Servlet容器,而JDK 1.6的Http Server则提供了基础的扩展能力。这些服务器可简化应用部署,减少与其他服务器的交互成本。
1492

被折叠的 条评论
为什么被折叠?



