亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? httputils.java

?? 用java編的一個(gè)聊天程序
?? JAVA
字號(hào):
/*
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 1999 The Apache Software Foundation.  All rights 
 * reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer. 
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution, if
 *    any, must include the following acknowlegement:  
 *       "This product includes software developed by the 
 *        Apache Software Foundation (http://www.apache.org/)."
 *    Alternately, this acknowlegement may appear in the software itself,
 *    if and wherever such third-party acknowlegements normally appear.
 *
 * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
 *    Foundation" must not be used to endorse or promote products derived
 *    from this software without prior written permission. For written 
 *    permission, please contact apache@apache.org.
 *
 * 5. Products derived from this software may not be called "Apache"
 *    nor may "Apache" appear in their names without prior written
 *    permission of the Apache Group.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the Apache Software Foundation.  For more
 * information on the Apache Software Foundation, please see
 * <http://www.apache.org/>.
 *
 * ====================================================================
 *
 * This source code implements specifications defined by the Java
 * Community Process. In order to remain compliant with the specification
 * DO NOT add / change / or delete method signatures!
 */ 


package javax.servlet.http;

import javax.servlet.ServletInputStream;
import java.util.Hashtable;
import java.util.ResourceBundle;
import java.util.StringTokenizer;
import java.io.IOException;


/**
 * Provides a collection of methods that are useful
 * in writing HTTP servlets.
 *
 * @author	Various
 * @version 	$Version$
 *
 */


public class HttpUtils {

    private static final String LSTRING_FILE =
	"javax.servlet.http.LocalStrings";
    private static ResourceBundle lStrings =
	ResourceBundle.getBundle(LSTRING_FILE);
    
    static Hashtable nullHashtable = new Hashtable();
    
    
    
    /**
     * Constructs an empty <code>HttpUtils</code> object.
     *
     */

    public HttpUtils() {}
    
    
    
    

    /**
     *
     * Parses a query string passed from the client to the
     * server and builds a <code>HashTable</code> object
     * with key-value pairs. 
     * The query string should be in the form of a string
     * packaged by the GET or POST method, that is, it
     * should have key-value pairs in the form <i>key=value</i>,
     * with each pair separated from the next by a & character.
     *
     * <p>A key can appear more than once in the query string
     * with different values. However, the key appears only once in 
     * the hashtable, with its value being
     * an array of strings containing the multiple values sent
     * by the query string.
     * 
     * <p>The keys and values in the hashtable are stored in their
     * decoded form, so
     * any + characters are converted to spaces, and characters
     * sent in hexadecimal notation (like <i>%xx</i>) are
     * converted to ASCII characters.
     *
     * @param s		a string containing the query to be parsed
     *
     * @return		a <code>HashTable</code> object built
     * 			from the parsed key-value pairs
     *
     * @exception IllegalArgumentException	if the query string 
     *						is invalid
     *
     */

    static public Hashtable parseQueryString(String s) {

	String valArray[] = null;
	
	if (s == null) {
	    throw new IllegalArgumentException();
	}
	Hashtable ht = new Hashtable();
	StringBuffer sb = new StringBuffer();
	StringTokenizer st = new StringTokenizer(s, "&");
	while (st.hasMoreTokens()) {
	    String pair = (String)st.nextToken();
	    int pos = pair.indexOf('=');
	    if (pos == -1) {
		// XXX
		// should give more detail about the illegal argument
		throw new IllegalArgumentException();
	    }
	    String key = parseName(pair.substring(0, pos), sb);
	    String val = parseName(pair.substring(pos+1, pair.length()), sb);
	    /*
	    System.out.println(key);
	    System.out.println(val);

	    if (ht.containsKey(key)) {
		String oldVals[] = (String []) ht.get(key);
		valArray = new String[oldVals.length + 1];
		for (int i = 0; i < oldVals.length; i++) 
		    valArray[i] = oldVals[i];
		valArray[oldVals.length] = val;
	    } else {
		valArray = new String[1];
		valArray[0] = val;
	    }
    	    ht.put(key, valArray);

*/	    
	    ht.put(key, val);
	}
	return ht;
    }




    /**
     *
     * Parses data from an HTML form that the client sends to 
     * the server using the HTTP POST method and the 
     * <i>application/x-www-form-urlencoded</i> MIME type.
     *
     * <p>The data sent by the POST method contains key-value
     * pairs. A key can appear more than once in the POST data
     * with different values. However, the key appears only once in 
     * the hashtable, with its value being
     * an array of strings containing the multiple values sent
     * by the POST method.
     *
     * <p>The keys and values in the hashtable are stored in their
     * decoded form, so
     * any + characters are converted to spaces, and characters
     * sent in hexadecimal notation (like <i>%xx</i>) are
     * converted to ASCII characters.
     *
     *
     *
     * @param len	an integer specifying the length,
     *			in characters, of the 
     *			<code>ServletInputStream</code>
     *			object that is also passed to this
     *			method
     *
     * @param in	the <code>ServletInputStream</code>
     *			object that contains the data sent
     *			from the client
     * 
     * @return		a <code>HashTable</code> object built
     *			from the parsed key-value pairs
     *
     *
     * @exception IllegalArgumentException	if the data
     *			sent by the POST method is invalid
     *
     */
     

    static public Hashtable parsePostData(int len, 
					  ServletInputStream in)
    {
	// XXX
	// should a length of 0 be an IllegalArgumentException
	
	if (len <=0)
	    return new Hashtable(); // cheap hack to return an empty hash

	if (in == null) {
	    throw new IllegalArgumentException();
	}
	
	//
	// Make sure we read the entire POSTed body.
	//
        byte[] postedBytes = new byte [len];
        try {
            int offset = 0;
       
	    do {
		int inputLen = in.read (postedBytes, offset, len - offset);
		if (inputLen <= 0) {
		    String msg = lStrings.getString("err.io.short_read");
		    throw new IllegalArgumentException (msg);
		}
		offset += inputLen;
	    } while ((len - offset) > 0);

	} catch (IOException e) {
	    throw new IllegalArgumentException(e.getMessage());
	}

        // XXX we shouldn't assume that the only kind of POST body
        // is FORM data encoded using ASCII or ISO Latin/1 ... or
        // that the body should always be treated as FORM data.
        //

        try {
            String postedBody = new String(postedBytes, 0, len, "8859_1");
            return parseQueryString(postedBody);
        } catch (java.io.UnsupportedEncodingException e) {
            // XXX function should accept an encoding parameter & throw this
            // exception.  Otherwise throw something expected.
            throw new IllegalArgumentException(e.getMessage());
        }
    }




    /*
     * Parse a name in the query string.
     */

    static private String parseName(String s, StringBuffer sb) {
	sb.setLength(0);
	for (int i = 0; i < s.length(); i++) {
	    char c = s.charAt(i); 
	    switch (c) {
	    case '+':
		sb.append(' ');
		break;
	    case '%':
		try {
		    sb.append((char) Integer.parseInt(s.substring(i+1, i+3), 
						      16));
		    i += 2;
		} catch (NumberFormatException e) {
		    // XXX
		    // need to be more specific about illegal arg
		    throw new IllegalArgumentException();
		} catch (StringIndexOutOfBoundsException e) {
		    String rest  = s.substring(i);
		    sb.append(rest);
		    if (rest.length()==2)
			i++;
		}
		
		break;
	    default:
		sb.append(c);
		break;
	    }
	}
	return sb.toString();
    }




    /**
     *
     * Reconstructs the URL the client used to make the request,
     * using information in the <code>HttpServletRequest</code> object.
     * The returned URL contains a protocol, server name, port
     * number, and server path, but it does not include query
     * string parameters.
     * 
     * <p>Because this method returns a <code>StringBuffer</code>,
     * not a string, you can modify the URL easily, for example,
     * to append query parameters.
     *
     * <p>This method is useful for creating redirect messages
     * and for reporting errors.
     *
     * @param req	a <code>HttpServletRequest</code> object
     *			containing the client's request
     * 
     * @return		a <code>StringBuffer</code> object containing
     *			the reconstructed URL
     *
     */

    public static StringBuffer getRequestURL (HttpServletRequest req) {
	StringBuffer url = new StringBuffer ();
	String scheme = req.getScheme ();
	int port = req.getServerPort ();
	String urlPath = req.getRequestURI();
	
	//String		servletPath = req.getServletPath ();
	//String		pathInfo = req.getPathInfo ();

	url.append (scheme);		// http, https
	url.append ("://");
	url.append (req.getServerName ());
	if ((scheme.equals ("http") && port != 80)
		|| (scheme.equals ("https") && port != 443)) {
	    url.append (':');
	    url.append (req.getServerPort ());
	}
	//if (servletPath != null)
	//    url.append (servletPath);
	//if (pathInfo != null)
	//    url.append (pathInfo);
	url.append(urlPath);
	return url;
    }
}



?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品夜夜嗨av一区二区三区| 亚洲特黄一级片| 日韩电影一区二区三区| 4438x亚洲最大成人网| 视频一区免费在线观看| 日韩一卡二卡三卡四卡| 国产在线精品一区二区不卡了 | 91精品国产入口在线| 丝瓜av网站精品一区二区| 欧美一级理论性理论a| 国产在线一区观看| 国产精品久久久久久久午夜片| 91麻豆精东视频| 日韩在线观看一区二区| 久久色在线观看| 91麻豆6部合集magnet| 日本亚洲最大的色成网站www| 日韩精品一区二区三区三区免费| 国产精品主播直播| 亚洲欧美偷拍卡通变态| 91精品国产黑色紧身裤美女| 国产91色综合久久免费分享| 一区二区三区日韩| 精品国一区二区三区| 欧美精品丝袜中出| 国产自产2019最新不卡| 亚洲另类春色校园小说| 日韩欧美在线综合网| 国产精品99久久久久久似苏梦涵| 亚洲卡通欧美制服中文| 精品欧美一区二区久久| 色伊人久久综合中文字幕| 免费看精品久久片| 亚洲欧美日韩中文字幕一区二区三区| 91精品久久久久久久91蜜桃| 从欧美一区二区三区| 日韩电影一区二区三区| 18欧美亚洲精品| 日韩欧美一区二区免费| 色域天天综合网| 国产精品综合二区| 亚洲第一久久影院| 国产精品久久久久精k8| 日韩欧美三级在线| 欧洲精品在线观看| 国产精品亚洲专一区二区三区| 亚洲成a人片在线观看中文| 国产精品水嫩水嫩| 欧美va日韩va| 欧美视频一二三区| 99免费精品视频| 国产乱码一区二区三区| 日本亚洲电影天堂| 一片黄亚洲嫩模| 中文字幕欧美一| 久久午夜国产精品| 日韩限制级电影在线观看| 欧美在线你懂得| 91在线视频官网| 国产成人精品亚洲777人妖 | 精品一区二区三区在线观看| 亚洲一卡二卡三卡四卡无卡久久| 亚洲国产精华液网站w| 精品国产3级a| 日韩欧美卡一卡二| 日韩一区二区在线看片| 欧美午夜影院一区| 91福利视频网站| 91麻豆产精品久久久久久 | 激情深爱一区二区| 免费看黄色91| 蜜桃91丨九色丨蝌蚪91桃色| 日韩福利电影在线| 免费看日韩a级影片| 日韩中文字幕一区二区三区| 亚洲www啪成人一区二区麻豆| 亚洲另类春色国产| 亚洲一区自拍偷拍| 亚洲国产一区二区a毛片| 夜夜嗨av一区二区三区网页| 亚洲六月丁香色婷婷综合久久 | 欧美日本一区二区在线观看| 欧美性大战xxxxx久久久| 91久久香蕉国产日韩欧美9色| 91亚洲永久精品| 在线观看亚洲精品视频| 欧美日韩精品一二三区| 制服丝袜亚洲网站| 欧美精品一区二区在线播放| 国产日本欧美一区二区| 欧美激情综合五月色丁香 | 精品国产一区二区三区av性色| 欧美精品一区男女天堂| 亚洲国产精品二十页| 亚洲欧美电影院| 亚欧色一区w666天堂| 日韩av一二三| 国产福利91精品一区二区三区| 粉嫩嫩av羞羞动漫久久久| 91网站视频在线观看| 欧美三级乱人伦电影| 日韩欧美的一区| 中文一区在线播放| 亚洲一区在线免费观看| 麻豆国产精品777777在线| 丁香激情综合五月| 在线欧美日韩国产| 欧美不卡一区二区三区| 日本一区二区三区久久久久久久久不 | 日韩亚洲欧美中文三级| 国产午夜精品理论片a级大结局| 国产精品国产馆在线真实露脸| 玉足女爽爽91| 激情图片小说一区| 91在线观看下载| 日韩欧美一二区| 中文字幕亚洲不卡| 日产国产欧美视频一区精品| 国产成人综合在线播放| 欧美在线观看视频在线| 久久久久久久久久久黄色| 亚洲在线成人精品| 国产乱码精品一区二区三| 91亚洲资源网| 精品国产一区久久| 亚洲乱码国产乱码精品精的特点| 精品综合久久久久久8888| 色94色欧美sute亚洲线路二| 久久亚洲一级片| 亚洲18影院在线观看| 成人午夜精品在线| 91精品国产91久久综合桃花| 国产精品视频免费| 另类小说视频一区二区| 在线看日韩精品电影| 亚洲国产精品v| 久久精品久久99精品久久| 欧美专区在线观看一区| 国产欧美精品一区二区三区四区| 三级亚洲高清视频| 色综合久久66| 国产精品国产精品国产专区不片| 久久精品国产**网站演员| 欧美三级日韩在线| 自拍偷在线精品自拍偷无码专区| 九九九久久久精品| 欧美一区二区三区播放老司机| 亚洲精品欧美激情| bt7086福利一区国产| 久久久久久久免费视频了| 蜜臀久久99精品久久久久宅男| 91啦中文在线观看| 国产精品另类一区| 国产九九视频一区二区三区| 日韩视频一区二区| 日韩av中文在线观看| 欧美日产国产精品| 婷婷成人激情在线网| 欧美做爰猛烈大尺度电影无法无天| 国产精品天干天干在观线| 国产福利电影一区二区三区| 26uuu亚洲| 国产自产视频一区二区三区| 日韩欧美国产三级电影视频| 欧美a级一区二区| 日韩一区二区影院| 蜜桃视频在线观看一区| 日韩欧美专区在线| 久88久久88久久久| 久久日一线二线三线suv| 国产一区高清在线| 久久亚洲二区三区| 国产麻豆成人精品| 国产精品欧美一区喷水| 成人黄色小视频在线观看| 国产精品大尺度| 91免费看`日韩一区二区| 一区二区理论电影在线观看| 欧洲精品中文字幕| 天天综合网 天天综合色| 欧美一区二区三区免费大片| 蜜桃av一区二区| 中文字幕欧美三区| 99re8在线精品视频免费播放| 亚洲免费av高清| 欧美日韩精品一区二区在线播放| 亚洲成人av一区二区三区| 日韩亚洲电影在线| 国产a视频精品免费观看| 国产精品免费观看视频| 欧美综合亚洲图片综合区| 日韩高清欧美激情| 国产亚洲精品中文字幕| 99精品视频在线播放观看| 亚洲成a人在线观看| 2023国产精品自拍| 99热这里都是精品| 亚洲国产wwwccc36天堂| 久久久久久久久久久黄色| 日本高清视频一区二区|