亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
91同城在线观看| 亚洲综合丁香婷婷六月香| 国产亚洲女人久久久久毛片| 久久精品一区二区三区不卡牛牛 | 日韩国产精品久久久久久亚洲| 日韩精品亚洲一区二区三区免费| 久久成人久久鬼色| 福利一区福利二区| 91在线一区二区三区| 欧美日本不卡视频| 欧美mv和日韩mv国产网站| 国产精品嫩草影院com| 亚洲制服欧美中文字幕中文字幕| 免费在线视频一区| 成人在线视频一区二区| 欧美亚洲综合在线| 久久综合一区二区| 亚洲精品视频一区| 久久精品理论片| 91视频xxxx| 精品久久久久久久久久久院品网| 综合欧美亚洲日本| 奇米亚洲午夜久久精品| 成人久久18免费网站麻豆| 欧美日韩一区三区| 国产视频一区二区在线| 亚洲图片自拍偷拍| 国产成人鲁色资源国产91色综 | 日本欧美一区二区三区| 国产不卡视频在线播放| 欧美日韩国产美| 欧美国产亚洲另类动漫| 亚洲电影你懂得| 风流少妇一区二区| 欧美性xxxxx极品少妇| 国产视频一区二区三区在线观看| 日韩黄色一级片| 91麻豆福利精品推荐| 精品三级av在线| 一区二区三区不卡在线观看 | 亚洲乱码国产乱码精品精可以看| 久久精品国产**网站演员| 色婷婷综合视频在线观看| 精品国产区一区| 亚洲bt欧美bt精品777| 99视频一区二区三区| 欧美成人精品3d动漫h| 亚洲欧美日韩系列| 亚洲成人av免费| 成人福利视频在线| 欧美一区二区福利视频| 亚洲欧美日韩国产手机在线| 国产在线播放一区| 欧美日韩免费观看一区三区| 国产精品久久久久久久久免费相片 | 日韩欧美中文字幕一区| 2024国产精品视频| 亚洲成人1区2区| 99久久亚洲一区二区三区青草| 日韩精品综合一本久道在线视频| 一区二区久久久| 成人综合在线观看| 日韩美女一区二区三区| 亚洲愉拍自拍另类高清精品| 成人激情文学综合网| 337p粉嫩大胆噜噜噜噜噜91av | 激情文学综合网| 日韩欧美电影在线| 亚洲电影一级片| 欧洲一区二区av| 国产精品不卡在线| 国产传媒久久文化传媒| 欧美大尺度电影在线| 午夜精品一区二区三区免费视频 | 亚洲国产一区二区在线播放| 99精品国产视频| 国产精品视频看| 国产精品亚洲一区二区三区妖精 | 亚洲免费在线观看| 国产jizzjizz一区二区| 久久久精品影视| 极品销魂美女一区二区三区| 欧美一级精品在线| 日韩av中文字幕一区二区三区| 欧美色视频在线观看| 一区二区三区四区不卡在线 | 亚洲国产精品99久久久久久久久| 黑人巨大精品欧美一区| 欧美视频一区在线| 亚洲欧美日韩国产综合在线| 国产美女精品人人做人人爽| 久久蜜桃香蕉精品一区二区三区| 久久66热re国产| 精品国产乱码久久久久久免费| 蜜桃精品视频在线| 精品久久久久久久久久久久久久久久久 | 国产一区美女在线| 欧美精品丝袜久久久中文字幕| 亚洲综合激情网| 日韩精品资源二区在线| 国产一区二区三区久久悠悠色av| 久久亚洲免费视频| 国产成人自拍高清视频在线免费播放| 久久精品视频在线免费观看 | 久久日韩粉嫩一区二区三区| 国产精品1区二区.| 中文字幕成人av| 91香蕉视频mp4| 一区二区三区影院| 欧美精品丝袜久久久中文字幕| 美女视频黄a大片欧美| 精品奇米国产一区二区三区| 国产盗摄女厕一区二区三区| 国产精品久久毛片a| 91亚洲精品久久久蜜桃| 香蕉久久一区二区不卡无毒影院| 欧美精品亚洲二区| 国产主播一区二区三区| 亚洲精品在线电影| 国产精品一区二区你懂的| 中文字幕国产精品一区二区| 在线一区二区三区四区五区| 天堂精品中文字幕在线| 日韩精品一区二区三区蜜臀| 国产精品99久久久久| 国产精品国产三级国产aⅴ原创| 色视频一区二区| 青青草原综合久久大伊人精品| 精品成人一区二区三区四区| 成人av中文字幕| 亚洲成人激情av| 精品国产电影一区二区| 成人av网站在线| 亚洲动漫第一页| 日韩一区二区三| 91影视在线播放| 免费久久99精品国产| 日本一区二区在线不卡| 在线观看视频一区二区欧美日韩| 男女男精品网站| 亚洲国产成人在线| 欧美色电影在线| 国产盗摄视频一区二区三区| 亚洲在线免费播放| 26uuu久久综合| 欧美亚洲尤物久久| 国产在线精品一区二区夜色| 国产精品乱码一区二三区小蝌蚪| 91国偷自产一区二区三区观看 | 一本色道久久综合狠狠躁的推荐| 偷窥国产亚洲免费视频| 欧美成人艳星乳罩| 粉嫩在线一区二区三区视频| 午夜精彩视频在线观看不卡| 中日韩av电影| 日韩一本二本av| 91捆绑美女网站| 国产一区二区三区免费| 亚洲成a人在线观看| 国产精品人妖ts系列视频| 91.麻豆视频| 色综合天天性综合| 国产精品一二三四五| 亚洲v精品v日韩v欧美v专区 | 99久久久久免费精品国产 | 在线精品视频免费观看| 粉嫩嫩av羞羞动漫久久久| 日韩不卡一二三区| 亚洲男人天堂av| 欧美国产国产综合| 日韩欧美电影一二三| 精品视频在线免费观看| 风间由美性色一区二区三区| 热久久免费视频| 成人欧美一区二区三区视频网页| 精品少妇一区二区三区日产乱码| 欧美欧美欧美欧美| 91成人国产精品| 91麻豆精东视频| 成人免费av网站| 国产乱码字幕精品高清av | 欧美日韩黄色影视| 91色视频在线| 不卡视频免费播放| 国产电影一区在线| 国产伦精品一区二区三区免费| 全部av―极品视觉盛宴亚洲| 午夜久久久久久久久 | 91日韩精品一区| 精品一区二区在线播放| 亚洲嫩草精品久久| 国产精品欧美久久久久一区二区| 2020日本不卡一区二区视频| 欧美va在线播放| 日韩一区二区三区电影在线观看 | 亚洲一区二区三区国产| 亚洲激情第一区| 亚洲综合在线第一页| 国产精品污污网站在线观看| 国产精品欧美一区二区三区|