(索引)关于实现Java的HTTP服务器 zt(0924更新

用Java实现HTTP服务的很多,但大部分都只是简单实现,很少有高性能的实现。最后聚焦到 AsyncWeb上,但是这个在07年中开发到0.9版本后,似乎已经停滞了,无法找到对应src和jar来下载,链接都是无效的。后来在一个play框 架中找到了一个发布版的asyncweb-common-0.9.0-SNAPSHOT.jar,然后根据这个又找到了asyncweb-core- 0.9.0-20061129.082938-1.jar和asyncweb-core-0.9.0-20070614.034125-7.jar等二进 制版本,但后者更旧。继续搜索,发现是AsyncWeb加入到apache的的sandbox沙箱,然后又合并到mina-filter-codec- http中了。但该项目最近修改也是Mon Nov 19 03:41:14 2007 UTC,也仅仅支持mina1.x版本,看来只能自己动手修改来支持mian2.x了。

原文:http://www.shengfang.org/blog/index.php?job=art&articleid=a_20090104_105011
20080412 java HTTP server【来源:http://www.shengfang.org】
http://users.skynet.be/pascalbotte/rcx-ws-doc/xmlpost.htm 1.5. Java HTTP post for XML SOAP message.
http://www.devdaily.com/java/jwarehouse/jakarta-tomcat-3.3.2-src/src/share/org/apache/tomcat/util/test/HttpRequest.java.shtml This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" 
http://docs.huihoo.com/java/se/jdk6/docs/guide/net/httpserver/spec/com/sun/net/httpserver/Headers.html#size() com.sun.net.httpserver 的 Class Headers
http://docs.huihoo.com/java/se/jdk6/docs/guide/net/httpserver/spec/com/sun/net/httpserver/HttpExchange.htmlcom.sun.net.httpserver 的 Class HttpExchange
http://blogs.sun.com/sandoz/ Jersey Client API (代码)
public class Test { 
public static void main(String[] args) throws IOException { 
HttpServer httpServer;
httpServer = HttpServer.create(new InetSocketAddress(81), 5);
httpServer.createContext("/", new Handler());
httpServer.start();
}

static class Handler implements HttpHandler { 
public void handle(HttpExchange exchange) throws IOException { 
Headers requestHeaders = exchange.getRequestHeaders();
Headers responseHeaders = exchange.getResponseHeaders();
responseHeaders.set("Content-Type", "text/plain");
exchange.sendResponseHeaders(200, 0L);
OutputStream responseBody = new BufferedOutputStream(exchange.getResponseBody(), 64*1024);
responseBody.write("Hello!".getBytes());
responseBody.close();
exchange.close();
}
}
http://excalibur.apache.org/download.cgi 
http://httpdbase4j.berlios.de/ HttpdBase4J是一个可嵌入的java web服务器架构,支持http , https协议,模板内容等.实现的类都易于继承,无论在http传输的哪个阶段,开发者可自由重写其框架行为.
http://www.jguru.com/forums/view.jsp?EID=1333689 How to server HTML in Java6 com.sun.net.httpserver?
最近在研究Http Server,在google上搜索到 com.sun.net.HttpServer package
http://excalibur.apache.org/download.cgi excalibur-instrument包中也有你需要的方法,这里是Apache的开源项目,而你找到的是sun公司的一个项目,如下是API页面http://excalibur.apache.org/apidocs/org/apache/excalibur/instrument/manager/http/server/HTTPServer.html
http://cindy.sourceforge.net/ Cindy is a robust, scalable and efficient asynchronous I/O framework, supports TCP, SSL over TCP, UDP and Pipe. It's released under the Apache 2.0 License.
Cindy 3.0b1 released 下载地址:http://cindy.sourceforge.net
修改记录:
* 添加了hello world示例
* 添加了简单的tcp/ip服务示例(echo/discard/daytime/chargen)
* 添加了telnet示例(tcp/udp)
* 更新了http server示例,支持列表目录
* 为DefaultPacket添加了两种构造函数:DefaultPacket(ByteBuffer)/DefaultPacket(byte[])
* 添加了SessionType类,并为Session/SessionAcceptor接口添加了getSessionType方法返回Session类型
* 为Configuration类添加了set方法
* 在SessionFactory类中加入了createSession(SessionType)和 createSessionAcceptor(SessionType)两个方法,原来的 createSocketSession/createDatagramSession/createSocketSessionAcceptor方法被 deprecated
* 修正DirectDispatcher.block中的bug,原实现在判断是否为核心线程方面存在Bug 
http://www.mortbay.org/ Jetty is an open-source, standards-based, full-featured web server implemented entirely in Java. It is released under the Apache 2.0 licence and is therefore free for commercial use and distribution. First created in 1995, Jetty has benefitted from input from a vast user community and consistent and focused development by a stable core of lead developers. There are many more examples of Jetty in action on the Jetty Powered Page that has selections from among the tens of thousands of production Jetty instances. However, as Jetty aims to be as unobtrusive as possible, countless websites and products are based around Jetty, but Jetty is invisible!
Full commercial support, training and development services for Jetty and Jetty-based projects are available from Webtide . 
http://www.onjava.com/pub/a/onjava/2003/04/23/java_webserver.html How Java Web Servers Work
http://java.sun.com/javase/6/docs/jre/api/net/httpserver/spec/com/sun/net/httpserver/package-summary.htmlPackage com.sun.net.httpserver
Mina、Cindy和QuickServer
http://dev.csdn.net/author/calvinxiu/e28cd84b9ddc4e88a34afce45eed8f68.html QuickServer--在吵闹的环境里快速搭建自己的TcpServer(Pragmatic系列)
http://www.blogdriver.com/zeroliu/1242606.html 循证架构:QuickServer/Cindy/Mina- -
http://blog.csdn.net/numenZQ/archive/2007/05/22/1621482.aspx 项目组织的最佳实践
设置文件夹结构并按照类型划分数据库对象。
http://blog.csdn.net/zhangliulin/archive/2007/10/16/1826707.aspx 设计一个美好的服务器--MINA、CXF、Mule、JBoss/Geronimo 
http://blog.csdn.net/zhangliulin/archive/2007/10/16/1826710.aspx 轻的,谁都会写的Service方案--REST与JSON 
最近研究了Java 通讯框架,感觉很不错,由于NETTY2的停止开发,Netty2的作者转而开发了MINA这个Framework,到是也不错,不过我建议有工夫的话, 各位不妨也看看咱们国产的Cindy ,呵呵,这可不是抵制日货才说的,这个Framework 到还不错,推荐给大家啊,实在没时间写 Cindy ,Jive Messenger 的相关资料,各位自己有空去研究一下吧,且作者最近的Cindy2.4我开也不错,下面有他的BLOG连接,自己去看吧!
Cindy blog : http://spaces.msn.com/members/crmky/
Java Eye Cindy : http://www.javaeye.com/viewtopic.php?t=11185&start=15
SourceForge : http://sourceforge.net/projects/cindy/
Cindy:http://cindy.sourceforge.net
Netty2:http://gleamynode.net/dev/
MINA:http://www.apache.org/~trustin/mina-20050207/index.html
http://www.javaeye.com/topic/33992 NIO框架Cindy中HTTP范例的一个BUG及修改 【虎.无名,似乎还是我自己早期的帖子
http://svn.apache.org/viewvc/mina/branches/1.0/example/src/main/java/org/apache/mina/example/httpserver/codec//mina/branches/1.0/example/src/main/java/org/apache/mina/example/httpserver/codec
http://docs.safehaus.org/display/ASYNCWEB/Home AsyncWeb is a high-throughput, non blocking Java HTTP engine - designed throughout to support asynchronous request processing
http://mina.apache.org/documentation.html Apache MINA - The High Performance Protocol Construction Toolkit (ApacheCon US 2007) 
Can MINA handle text protocols such as HTTP?
Yes. Please take a look at the Reversed and HTTP server examples. AsyncWeb is a HTTP server implementation based on MINA.
http://hi.baidu.com/jabber/ 
* Java中目前有2种选择,一种是基于Apache MINA框架的,稍复杂但适合用在大场合;一种是基于Java Web容器自己提供的支持,如Jetty和Tomcat,适合comet只是应用中一小部分场合。
* Mina只是个网络层(相当socket层)的框架,如果用mina需要自己实现HTTP协议。好消息是这个工作已经有开源做了,一个叫Asyncweb 项目在mina的基础上实现了HTTP协议层的封装。而且asyncweb正在被mina合并,将加入到mina的发行版中。
用asyncweb编程很简单,只需实现一个接口,实际上只需要实现 handleRequest, 在 request 返回结果。
public interface HttpService { 
void handleRequest( HttpServiceContext context ) throws Exception;
void start();
void stop();
}
AsyncWeb是一个高性能,非阻塞(non-blocking ),可内嵌在应用程序中使用的Java HTTP引擎。它始终围绕支持异步请求处理而设计。AsyncWeb还能与Spring框架集成。
http://www.blogjava.net/hengheng123456789/archive/2007/09/03/142325.html MINA Beginning
http://hi.baidu.com/zeorliu/blog/item/80d2b26e3b3e10de80cb4a62.html 使用Apache-MINA开发高性能网络应用程序(转)
http://www.w3.org/Jigsaw/User/api/w3c.www.http.HttpRequestMessage.html Class w3c.www.http.HttpRequestMessage
NanoHTTPD
A free, simple, tiny (1 java file!), nicely embeddable HTTP server in Java.
Getting the software:
nanohttpd is currently a pre-alpha software. This means that no stable version is available. Thus, to make sure you get the freshest version, you should use CVS:
cvs -d:pserver:anonymous at cvs dot sourceforge.net:/cvsroot/nanohttpd login 
cvs -z3 -d:pserver:anonymous at cvs dot sourceforge.net:/cvsroot/nanohttpd co nanohttpd
http://nanohttpd.sourceforge.net/example.html
The Fizmez Web Server is a small Web server written in Java. Its source code can serve as a useful learning tool for those who wish to learn about Java server sockets.
http://freshmeat.net/projects/fizmezwebserver/
http://javenstudio.org/blog/?page_id=25 SOCKET的封装(Java中Socket类的C++实现)
http://blog.csdn.net/jackfor001/archive/2007/12/14/1936594.aspx Mina 应用开发---新手入门
pygmy: 最近做得p2p项目要用到pygmy这个微型http server。pygmy的用法非常简单,首先是一份properties文件,可以是这个样子:
https://sourceforge.net/project/showfiles.php?group_id=87807 Pygmy is a 40KB portable http stack written in Java. It is ideal for PDA and resource limited devices, as well as desktop applications and server applications. Pygmy provides a plug-in architecture so features can be added and removed easily.
http://www.open-open.com/30.htm 
http://cucme.blog.163.com/blog/static/6804543200792411039843/ java代码框架示例……socket通信(server)
http://hi.baidu.com/ofbase/blog/item/29fe2e24f2c8e72ad50742de.html Apache MINA 线程模型配置
http://www.zeali.net/entry/70 Http协议客户端的JAVA简单实现
http://dev.csdn.net/article/7/7991.shtm 用Java实现Web服务器
http://tech.163.com/tm/030531/030531_95888.html 实战Java Web服务器--使用HTTP协议和JAVA类实现

(0924更新AsyncWeb相关内容)【虎.无名】to transient1984 :我 也是费了很多力气才找到asyncweb的,最新的库只有asyncweb-core-0.9.0-20070614.034125-7.jar,后续似 乎没再更新了,但这个版本只支持Mina2M2版本,到后来的M3,M4的API变动很大,需要手工修改好几个地方。有文章说将要融合到Mina2中,但 到目前Mina2M6版,尚未成为现实。你可以参考如下几个链接的内容:

http://wutaoo.javaeye.com/blog/373640 实现server遇阻。回头学习一下netty自带的一个http server实现。
http://amozon.javaeye.com/blog/322528 Mina2.0 example HttpServer
【虎.无名】猜想mina2可通过filter-codec-netty使用netty的解析器。
--------------------
新的地址SVN地址
http://trac-hg.assembla.com/scala-mina/browser/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http?rev=31:9fe1c96b96dc
http://trac-hg.assembla.com/scala-mina/browser
--------------------

2,直接搜索jar文件
http://m2.safehaus.org/org/safehaus/asyncweb/asyncweb-core/
0.8.3-SNAPSHOT/         02-Nov-2006 02:53      - 
0.9.0-SNAPSHOT/         13-Jun-2007 22:41      - 
http://m2.safehaus.org/org/safehaus/asyncweb/asyncweb-core/0.9.0-SNAPSHOT/
asyncweb-core-0.9.0-..> 29-Nov-2006 02:30   154k 
asyncweb-core-0.9.0-..> 05-Dec-2006 02:30   155k 
asyncweb-core-0.9.0-..> 05-Dec-2006 02:37   155k 
asyncweb-core-0.9.0-..> 06-Dec-2006 03:41   154k 
asyncweb-core-0.9.0-..> 13-Dec-2006 04:06   154k 
asyncweb-core-0.9.0-..> 29-Jan-2007 20:31   154k 
asyncweb-core-0.9.0-..> 13-Jun-2007 22:41   154k 
3,搜索mina-filter-codec-http相关信息
* Moved AsyncWeb HTTP codec to mina-filter-codec-http
* Rewrote the existing HTTP client codec
* ProtocolCodecFactory.getEncoder/getDecoder() now are provided with an IoSession parameter.
http://svn.apache.org/viewvc/mina/trunk/filter-codec-http/src/main/java/org/apache/mina/filter/codec/http/?pathrev=612014
以下内容只针对mina1版本
http://svn.apache.org/viewvc/mina/branches/1.0/example/src/main/java/org/apache/mina/example/httpserver/codec/


你可能感兴趣的:(sql,server)