欢迎来到天天文库
浏览记录
ID:57405539
大小:152.00 KB
页数:13页
时间:2020-08-16
《基于httpcorehttpclientcomponent搭建轻量级http服务器.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、基于httpcore(httpclientcomponent)搭建轻量级http服务器————————————————————————————————作者:————————————————————————————————日期:基于httpcore(httpclientcomponent)搭建轻量级http服务器下面是apache官网例子服务器端接受请求,实现接收文件请求处理器importjava.io.File;importjava.io.IOException;importjava.io.InterruptedIOException;importjav
2、a.net.ServerSocket;importjava.net.Socket;importjava.net.URL;importjava.net.URLDecoder;importjava.nio.charset.Charset;importjava.security.KeyStore;importjava.util.Locale;importorg.apache.http.ConnectionClosedException;importorg.apache.http.HttpConnectionFactory;importorg.apache.ht
3、tp.HttpEntity;importorg.apache.http.HttpEntityEnclosingRequest;importorg.apache.http.HttpException;importorg.apache.http.HttpRequest;importorg.apache.http.HttpResponse;importorg.apache.http.HttpServerConnection;importorg.apache.http.HttpStatus;importorg.apache.http.MethodNotSuppo
4、rtedException;importorg.apache.http.entity.ContentType;importorg.apache.http.entity.FileEntity;importorg.apache.http.entity.StringEntity;importorg.apache.http.impl.DefaultBHttpServerConnection;importorg.apache.http.impl.DefaultBHttpServerConnectionFactory;importorg.apache.http.pr
5、otocol.BasicHttpContext;importorg.apache.http.protocol.HttpContext;importorg.apache.http.protocol.HttpProcessor;importorg.apache.http.protocol.HttpProcessorBuilder;importorg.apache.http.protocol.HttpRequestHandler;importorg.apache.http.protocol.HttpService;importorg.apache.http.p
6、rotocol.ResponseConnControl;importorg.apache.http.protocol.ResponseContent;importorg.apache.http.protocol.ResponseDate;importorg.apache.http.protocol.ResponseServer;importorg.apache.http.protocol.UriHttpRequestHandlerMapper;importorg.apache.http.util.EntityUtils;importjavax.net.s
7、sl.KeyManager;importjavax.net.ssl.KeyManagerFactory;importjavax.net.ssl.SSLContext;importjavax.net.ssl.SSLServerSocketFactory;/***Basic,yetfullyfunctionalandspeccompliant,HTTP/1.1fileserver.*/publicclassElementalHttpServer{publicstaticvoidmain(String[]args)throwsException{if(args
8、.length<1){System.err.println("Pleasespe
此文档下载收益归作者所有