介绍三种可以嵌入到应用程序的轻量级的Http Server

本文介绍了适用于Java实用程序应用的三种轻量级Http Server:Nano Server,Embedded Jetty和JDK 1.6自带的Http Server。Nano Server是最小的HTTP服务器,Jetty是一款功能齐全的Servlet容器,而JDK 1.6的Http Server则提供了基础的扩展能力。这些服务器可简化应用部署,减少与其他服务器的交互成本。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值