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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? httputils.java

?? jsp數據庫系統
?? JAVA
字號:
/*
 * 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);
	    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);
	}
	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;
    }
}



?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人av一区二区三区| 色欧美片视频在线观看在线视频| 在线中文字幕不卡| 日韩午夜电影av| 日韩影视精彩在线| 琪琪一区二区三区| 69精品人人人人| 亚洲精品国产品国语在线app| 日韩激情一二三区| 色综合久久久久久久久久久| 中文字幕一区在线| 国产精品自在在线| 国产日韩欧美高清| 成人美女在线视频| 欧美电视剧免费全集观看| av网站免费线看精品| 日韩精品中文字幕一区二区三区| 亚洲国产精品影院| 欧美片网站yy| 日韩高清电影一区| 久久久久国色av免费看影院| 国产黄色精品视频| 《视频一区视频二区| 色呦呦国产精品| 一区二区久久久| 欧美va亚洲va| 一区二区在线观看视频 | 欧美日韩国产精品成人| 欧美自拍偷拍一区| 亚洲成av人影院在线观看网| 欧美日韩国产影片| 精品91自产拍在线观看一区| 亚洲精品视频在线观看网站| 蜜臀va亚洲va欧美va天堂| 免费久久99精品国产| 国产成人免费网站| 在线成人免费观看| 一区二区免费视频| 99国产精品久久久久久久久久 | 高清不卡在线观看| 午夜精彩视频在线观看不卡| 久久久综合视频| 3d动漫精品啪啪1区2区免费| 成人黄色小视频| 综合婷婷亚洲小说| 一本到不卡精品视频在线观看| 亚洲精品高清在线观看| 欧美xfplay| 91精品国产欧美日韩| 99热精品一区二区| 成人激情视频网站| 麻豆精品国产91久久久久久| 亚洲成人中文在线| 中文字幕日韩精品一区| 久久久久亚洲蜜桃| 中文字幕va一区二区三区| 欧美成人性战久久| 色婷婷综合激情| 色天天综合色天天久久| 亚洲综合一区二区| 中文字幕在线不卡一区二区三区| 亚洲成人三级小说| 性做久久久久久| 亚洲综合色婷婷| 欧美国产日韩一二三区| 欧美老人xxxx18| 欧美日韩国产综合一区二区| 337p亚洲精品色噜噜| 日韩精品一二三| 2023国产精品| 国产精品美女久久福利网站| 成人av在线看| 亚洲一卡二卡三卡四卡五卡| 欧美绝品在线观看成人午夜影视| 午夜精品一区二区三区电影天堂| 欧美剧情电影在线观看完整版免费励志电影 | 亚洲欧美偷拍三级| 午夜久久久久久| 另类专区欧美蜜桃臀第一页| 激情综合网av| 欧美在线观看视频在线| 欧美成人性福生活免费看| 亚洲国产精品激情在线观看| 国产农村妇女毛片精品久久麻豆| 国产精品午夜免费| 日韩一区中文字幕| 久久成人av少妇免费| 欧美日韩国产综合一区二区| 国产日产欧美一区| 青青国产91久久久久久| 99国产一区二区三精品乱码| 日韩视频一区在线观看| 精品国产成人在线影院| 久久九九影视网| 亚洲人成精品久久久久久| 日韩高清电影一区| 91香蕉国产在线观看软件| 国产午夜精品一区二区| 亚洲乱码精品一二三四区日韩在线| 亚洲第一搞黄网站| 欧美电影免费观看高清完整版| 精品一区二区三区在线观看| 日韩亚洲欧美在线观看| 久久精品一二三| 亚洲精品va在线观看| 欧美日韩国产影片| 国产精品一区久久久久| 狠狠狠色丁香婷婷综合久久五月| 国产毛片一区二区| 五月综合激情日本mⅴ| 欧美国产精品一区二区三区| 91精品国模一区二区三区| 国产原创一区二区三区| 午夜久久久影院| 一个色综合网站| 国产精品色眯眯| 亚洲视频在线一区| 欧美在线免费播放| 国产精品18久久久| 欧美a级一区二区| 国产欧美一区二区精品婷婷| 在线观看日韩国产| 久久66热偷产精品| 香蕉久久一区二区不卡无毒影院 | 成人网页在线观看| 午夜日韩在线电影| 亚洲欧美视频一区| 欧美国产日韩精品免费观看| 欧美剧在线免费观看网站 | 丝袜诱惑亚洲看片| 亚洲欧美日本韩国| 国产欧美日韩一区二区三区在线观看 | 欧美精品一区二区高清在线观看| 91麻豆国产福利在线观看| 麻豆精品久久精品色综合| 成人久久久精品乱码一区二区三区| 蜜臀va亚洲va欧美va天堂 | 欧美三级日本三级少妇99| 中文成人综合网| 日韩欧美国产一区二区在线播放| 欧美日韩国产美女| 欧美日韩一区二区三区视频| 婷婷中文字幕一区三区| 欧美精品777| 一区二区三区四区五区视频在线观看| 国产精品视频yy9299一区| 亚洲精品高清在线| 久久电影网电视剧免费观看| 国产成人啪免费观看软件| 99久久国产综合精品色伊| 欧美日韩激情在线| 久久久99久久精品欧美| 亚洲综合图片区| 久久99最新地址| 91麻豆国产精品久久| 精品久久久久久久久久久院品网| 337p日本欧洲亚洲大胆精品| 亚洲国产成人av网| 国产麻豆欧美日韩一区| 欧美性猛交xxxx黑人交| 日韩三级视频在线看| 午夜免费久久看| 国产一区二区精品久久99| 91国偷自产一区二区三区成为亚洲经典 | 精品国产露脸精彩对白| 一区二区三区中文字幕电影| 奇米777欧美一区二区| 99re66热这里只有精品3直播| 制服视频三区第一页精品| 中文字幕av资源一区| 美女网站色91| 欧美日韩黄色影视| 国产精品久久777777| 久久99在线观看| 欧美日韩国产精选| 亚洲精品乱码久久久久久黑人| 国产一区二区三区免费观看| 欧美日韩在线三级| 亚洲色图制服丝袜| 国产成人免费xxxxxxxx| 欧美一区二区精品久久911| 亚洲综合网站在线观看| 99热99精品| 国产欧美日韩视频在线观看| 丝袜亚洲另类欧美| 在线视频国产一区| 中文字幕亚洲一区二区av在线| 紧缚奴在线一区二区三区| 欧美美女一区二区| 亚洲情趣在线观看| 成人精品一区二区三区中文字幕| 欧美成人在线直播| 免费一级片91| 日韩一区二区三区四区| 午夜一区二区三区视频| 一本一本大道香蕉久在线精品| 国产精品少妇自拍| www.欧美日韩| 亚洲日本va午夜在线影院| 9l国产精品久久久久麻豆|