亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
日本高清无吗v一区| 欧美精品国产精品| 欧美绝品在线观看成人午夜影视| 日韩视频在线你懂得| 17c精品麻豆一区二区免费| 日韩av一区二区在线影视| eeuss鲁一区二区三区| 日韩网站在线看片你懂的| 亚洲一区在线视频| av成人免费在线观看| 久久午夜色播影院免费高清| 午夜av一区二区三区| 一本色道久久综合亚洲aⅴ蜜桃| 久久久久久麻豆| 免费在线观看成人| 欧美日韩午夜在线| 亚洲精品自拍动漫在线| 成人福利在线看| 国产亚洲欧美一级| 国产一区二区久久| 26uuu精品一区二区| 开心九九激情九九欧美日韩精美视频电影 | 精品国产精品网麻豆系列 | 亚州成人在线电影| 日本大香伊一区二区三区| 中文字幕在线不卡| 国产91丝袜在线播放0| 久久久www成人免费毛片麻豆 | www.亚洲色图.com| 欧美激情一区二区三区不卡 | 亚洲第一精品在线| 欧美色综合网站| 亚洲国产精品欧美一二99| 色噜噜狠狠一区二区三区果冻| 亚洲青青青在线视频| av在线这里只有精品| 亚洲精品成人悠悠色影视| 色哟哟在线观看一区二区三区| 17c精品麻豆一区二区免费| 99精品在线观看视频| 亚洲乱码中文字幕| 欧美色男人天堂| 天堂资源在线中文精品| 91精品国产乱码久久蜜臀| 日韩高清一级片| 日韩精品中文字幕一区二区三区 | 欧美日韩一区二区三区高清| 午夜视频一区二区三区| 日韩一区二区三区av| 国产一区在线精品| 中文幕一区二区三区久久蜜桃| 国产成人午夜电影网| 亚洲柠檬福利资源导航| 欧美高清激情brazzers| 久久国产生活片100| 国产精品全国免费观看高清 | 91精品国产综合久久蜜臀| 蜜臂av日日欢夜夜爽一区| 久久久天堂av| 欧美天堂一区二区三区| 韩国理伦片一区二区三区在线播放| 国产婷婷一区二区| 欧美性xxxxxxxx| 国模一区二区三区白浆| 最近中文字幕一区二区三区| 欧美日韩在线播放一区| 久久国产精品99久久久久久老狼| 国产亚洲综合色| 欧洲精品一区二区| 国产剧情一区二区三区| 亚洲综合在线电影| 久久精品视频免费观看| 色婷婷亚洲综合| 美女精品一区二区| 亚洲免费观看在线视频| 精品sm在线观看| 欧美专区日韩专区| 狠狠色丁香婷综合久久| 亚洲综合色噜噜狠狠| 久久一日本道色综合| 欧美日韩一区高清| proumb性欧美在线观看| 老司机免费视频一区二区三区| 亚洲日本在线视频观看| 久久午夜色播影院免费高清| 欧美日韩欧美一区二区| 99久久久国产精品免费蜜臀| 另类人妖一区二区av| 天天色天天爱天天射综合| 亚洲欧洲色图综合| 亚洲国产精品av| 91精品国产色综合久久不卡电影 | 激情综合色播五月| 天堂蜜桃91精品| 亚洲一区中文日韩| 亚洲黄色免费网站| 亚洲欧洲色图综合| 国产精品私人影院| 久久久久久久综合色一本| 日韩免费在线观看| 欧美日韩免费在线视频| 色美美综合视频| 91在线免费播放| 久久这里只有精品首页| 欧美一级国产精品| 欧美二区在线观看| 欧美精选一区二区| 欧美视频完全免费看| 欧美日韩在线综合| 欧美女孩性生活视频| 在线观看日产精品| 91黄色在线观看| 欧美性做爰猛烈叫床潮| 在线观看国产一区二区| 欧美日韩黄视频| 欧美酷刑日本凌虐凌虐| 欧美一区二区二区| 日韩欧美三级在线| 精品福利在线导航| 久久久久久综合| 国产精品国产三级国产a| 国产精品电影一区二区| 综合av第一页| 一级日本不卡的影视| 亚洲综合色丁香婷婷六月图片| 亚洲一区二区精品视频| 天堂av在线一区| 麻豆精品视频在线观看视频| 精品中文av资源站在线观看| 日本系列欧美系列| 国产精品综合在线视频| 波多野结衣在线一区| 91成人免费网站| 欧美日韩亚洲综合一区| 欧美一区二区三区视频免费| 精品国产第一区二区三区观看体验 | 日韩三级高清在线| 亚洲精品在线观| 国产精品丝袜一区| 亚洲精品伦理在线| 美女视频一区在线观看| 国产乱人伦精品一区二区在线观看| 成人少妇影院yyyy| 在线国产电影不卡| 亚洲成人激情综合网| 人人狠狠综合久久亚洲| 国产精品18久久久| 欧洲激情一区二区| 欧美精品一区二区三区蜜臀| 国产精品初高中害羞小美女文| 亚洲综合色噜噜狠狠| 极品美女销魂一区二区三区免费| 成人少妇影院yyyy| 欧美高清dvd| 中文字幕日韩一区二区| 琪琪久久久久日韩精品| 国产ts人妖一区二区| 欧美人与禽zozo性伦| 国产喷白浆一区二区三区| 亚洲一区二区美女| 成人永久看片免费视频天堂| 欧美精品久久99| 亚洲欧美日韩中文播放 | 一区二区三区在线高清| 日韩一区欧美二区| 福利一区二区在线| 日韩免费看的电影| 亚洲精品五月天| 成人丝袜18视频在线观看| 9191国产精品| 亚洲乱码精品一二三四区日韩在线 | 国产成人精品免费网站| 欧美日韩国产123区| 亚洲欧美自拍偷拍色图| 精品在线亚洲视频| 欧美视频在线观看一区二区| 国产精品亲子伦对白| 奇米888四色在线精品| 色中色一区二区| 国产精品美女久久久久久久| 美腿丝袜亚洲色图| 欧美日本精品一区二区三区| 亚洲女爱视频在线| hitomi一区二区三区精品| 久久久91精品国产一区二区三区| 首页国产欧美日韩丝袜| 欧美日韩专区在线| 亚洲免费在线观看| av成人老司机| 亚洲视频在线观看一区| av亚洲精华国产精华精华| 国产精品蜜臀在线观看| 国产传媒一区在线| 久久麻豆一区二区| 国产精品一卡二卡在线观看| 久久品道一品道久久精品| 久久99九九99精品| 欧美成人国产一区二区| 久久97超碰国产精品超碰| 日韩视频免费观看高清完整版|