以文本方式查看主題

-  曙海教育集團論壇  (http://m.scb-ycwb.com/bbs/index.asp)
--  JAVA語言開發  (http://m.scb-ycwb.com/bbs/list.asp?boardid=64)
----  用java語言實現的迷你型的http服務器代碼  (http://m.scb-ycwb.com/bbs/dispbbs.asp?boardid=64&id=2487)

--  作者:wangxinxin
--  發布時間:2010-12-11 10:16:36
--  用java語言實現的迷你型的http服務器代碼
package  positron.harness;

import  java.io.BufferedReader;
import  java.io.ByteArrayInputStream;
import  java.io.File;
import  java.io.FileInputStream;
import  java.io.IOException;
import  java.io.InputStream;
import  java.io.InputStreamReader;
import  java.io.OutputStream;
import  java.io.PrintWriter;
import  java.io.UnsupportedEncodingException;
import  java.net.ServerSocket;
import  java.net.Socket;
import  java.net.URLEncoder;
import  java.util.Date;
import  java.util.Enumeration;
import  java.util.HashMap;
import  java.util.Locale;
import  java.util.Map;
import  java.util.Properties;
import  java.util.StringTokenizer;
import  java.util.TimeZone;

/**
 * A simple, tiny, nicely embeddable HTTP 1.0 server in Java
 *
 * This class has been trivially modified from its original form, taken from
 * 
http://elonen.iki.fi/code/nanohttpd/NanoHTTPD.java
 *
 * <p> NanoHTTPD version 1.1,
 * Copyright &copy; 2001,2005-2007 Jarno Elonen (elonen@iki.fi, 
http://iki.fi/elonen/ )
 *
 * <p><b>Features + limitations: </b><ul>
 *
 *    <li> Only one Java file </li>
 *    <li> Java 1.1 compatible </li>
 *    <li> Released as open source, Modified BSD licence </li>
 *    <li> No fixed config files, logging, authorization etc. (Implement yourself if you need them.) </li>
 *    <li> Supports parameter parsing of GET and POST methods </li>
 *    <li> Supports both dynamic content and file serving </li>
 *    <li> Never caches anything </li>
 *    <li> Doesn\'t limit bandwidth, request time or simultaneous connections </li>
 *    <li> Default code serves files and shows all HTTP parameters and headers</li>
 *    <li> File server supports directory listing, index.html and index.htm </li>
 *    <li> File server does the 301 redirection trick for directories without \'/\'</li>
 *    <li> File server supports simple skipping for files (continue download) </li>
 *    <li> File server uses current directory as a web root </li>
 *    <li> File server serves also very long files without memory overhead </li>
 *    <li> Contains a built-in list of most common mime types </li>
 *    <li> All header names are converted lowercase so they don\'t vary between browsers/clients </li>
 *
 * </ul>
 *
 * <p><b>Ways to use: </b><ul>
 *
 *    <li> Run as a standalone app, serves files from current directory and shows requests</li>
 *    <li> Subclass serve() and embed to your own program </li>
 *    <li> Call serveFile() from serve() with your own base directory </li>
 *
 * </ul>
 *
 * See the end of the source file for distribution license
 * (Modified BSD licence)
 
*/
public   class  NanoHTTPD
{
    
//  ==================================================
    
//  API parts
    
//  ==================================================

    
/**
     * Override this to customize the server.<p>
     *
     * (By default, this delegates to serveFile() and allows directory listing.)
     *
     * @parm uri    Percent-decoded URI without parameters, for example "/index.cgi"
     * @parm method    "GET", "POST" etc.
    

主站蜘蛛池模板: 老子影院在线观看| 国产精品免费一区二区三区四区| 校花公交车上被迫打开双腿| 美女被羞羞在线观看漫画| 91在线你懂的| 中文国产成人精品久久水| 亚洲AV激情无码专区在线播放| 冬月枫亚洲高清在线观看| 国产无遮挡AAA片爽爽| 在线看的你懂的| 性欧美hd调教| 日本夜爽爽一区二区三区| 欧美性色欧美a在线播放| 男人添女人下部高潮全视频| 色天使色婷婷在线影院亚洲| 福利网址在线观看| 91最新地址永久入口| www一级毛片| 一本色道久久88亚洲精品综合| 久久亚洲精品无码观看不卡| 亚洲午夜电影一区二区三区| 亚洲精品欧洲精品| 人人妻人人澡人人爽欧美精品 | 中文字幕精品视频在线| 久久综合九色综合97伊人麻豆| 亚洲国产精品综合久久网络| 亚洲综合天堂网| 亚洲综合色色图| 免费观看a黄一级视频| 周妍希美乳三点尽露四季图片 | 99国产精品久久久久久久成人热| 三级免费黄录像| 一卡二卡三卡在线| 一本色道久久88亚洲精品综合| 中文在线免费观看| 一级做性色a爰片久久毛片| 中文有码在线观看| 中文字幕25页| yy6080午夜一级毛片超清| 一女被两男吃奶玩乳尖| jizzjizzjizz中国|