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

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

?? httputils.java

?? jsp數(shù)據(jù)庫系統(tǒng)
?? 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;
    }
}



?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色一情一伦一子一伦一区| 国产女人aaa级久久久级| 中文字幕亚洲区| 老汉av免费一区二区三区| 欧洲一区二区av| 亚洲精品视频一区二区| 99久久综合99久久综合网站| 精品成人在线观看| 久久国产精品免费| 久久久久久久久97黄色工厂| 韩国v欧美v亚洲v日本v| 久久久91精品国产一区二区精品 | 日韩精品91亚洲二区在线观看| 91美女视频网站| 伊人一区二区三区| 欧美性感一区二区三区| 偷拍日韩校园综合在线| 欧美精品 国产精品| 精品一区二区三区欧美| 国产目拍亚洲精品99久久精品| 成人福利视频在线看| 一二三四区精品视频| 欧美羞羞免费网站| 另类小说综合欧美亚洲| 国产精品嫩草影院av蜜臀| 91美女片黄在线观看| 视频一区二区中文字幕| 精品免费国产一区二区三区四区| 国产成人午夜片在线观看高清观看| 日本一区二区三区久久久久久久久不| 国产精品综合久久| 亚洲一区在线视频| 国产情人综合久久777777| 色94色欧美sute亚洲13| 日韩av一区二区三区| 国产精品国产三级国产普通话蜜臀| 在线观看www91| 国产成人免费网站| 婷婷综合另类小说色区| 亚洲色图清纯唯美| 久久久久久久久久久电影| 欧美性受极品xxxx喷水| 成人福利视频网站| 狠狠色狠狠色合久久伊人| 爽好多水快深点欧美视频| 国产精品久久久久久久浪潮网站 | 国产精品一区二区在线播放| 亚洲成av人片一区二区梦乃| 亚洲久草在线视频| 日本一区二区高清| 亚洲男人天堂av| 粉嫩av一区二区三区粉嫩| 看电影不卡的网站| 视频一区二区三区入口| 亚洲国产日产av| 一级精品视频在线观看宜春院| 国产精品美女www爽爽爽| 久久久久久久久免费| 2021中文字幕一区亚洲| 精品国产凹凸成av人导航| 精品国产乱码久久久久久久| 精品少妇一区二区三区在线播放| 91麻豆精品国产91久久久资源速度| 欧美日本韩国一区| 日韩美女一区二区三区四区| 欧美大片在线观看| 欧美国产精品一区二区| 久久精品夜色噜噜亚洲aⅴ| 久久精品亚洲麻豆av一区二区| 欧美国产精品中文字幕| 亚洲精品视频一区| 免费人成精品欧美精品| 国产99精品国产| 在线亚洲一区二区| 91精品国产免费| 国产日本欧美一区二区| 一区二区国产视频| 精品一区二区三区欧美| 日本高清成人免费播放| 欧美大片一区二区| 自拍偷拍亚洲欧美日韩| 青草av.久久免费一区| 国产91精品入口| 欧美日韩国产大片| 久久免费偷拍视频| 亚洲综合激情另类小说区| 国产美女在线观看一区| 欧美四级电影网| 国产亚洲综合在线| 日韩成人免费看| 欧美三级日韩在线| 国产精品久久久久久久久动漫 | 成人午夜精品在线| 91麻豆精品国产91久久久久久| 国产精品久久午夜| 国产夫妻精品视频| 日韩欧美视频在线| 午夜精品久久久久久| 91免费观看视频| 亚洲日本成人在线观看| 成人免费电影视频| 亚洲国产电影在线观看| 国产毛片精品视频| 日韩欧美激情一区| 精品一区二区在线视频| 久久美女艺术照精彩视频福利播放| 午夜av电影一区| 777奇米四色成人影色区| 日韩黄色免费电影| 欧美一区二区不卡视频| 美女看a上一区| 久久免费视频一区| 成人av小说网| 亚洲国产精品久久久久秋霞影院| 欧美在线观看视频在线| 日日夜夜免费精品视频| 日韩三级.com| 99riav一区二区三区| 午夜精品一区在线观看| 欧美一卡二卡三卡| 国产成人免费高清| 一区二区三区日韩欧美精品| 欧美高清视频不卡网| 国模大尺度一区二区三区| 国产精品青草综合久久久久99| 欧美综合一区二区三区| 美女网站在线免费欧美精品| 国产精品美女久久久久久久久 | 91精品国产综合久久蜜臀| 国产麻豆欧美日韩一区| 亚洲高清免费在线| 久久综合精品国产一区二区三区| 日本韩国一区二区三区视频| 麻豆91精品91久久久的内涵| 亚洲六月丁香色婷婷综合久久 | 一本大道久久a久久精二百| 日本欧美在线观看| 一区二区三区在线观看网站| 欧美精品一区二区久久久| 欧美无乱码久久久免费午夜一区 | 亚洲精品网站在线观看| 久久精品男人天堂av| 欧美一级夜夜爽| 91精品欧美一区二区三区综合在 | 国产久卡久卡久卡久卡视频精品| 亚洲一二三区在线观看| 亚洲欧美日韩国产手机在线| 国产三级欧美三级| 国产欧美日韩在线视频| 久久综合色之久久综合| 欧美成va人片在线观看| 日韩欧美国产精品一区| 日韩欧美亚洲国产精品字幕久久久 | 国产91精品在线观看| 国产成人日日夜夜| av网站一区二区三区| aa级大片欧美| 欧美日韩视频不卡| 欧美一区二区视频观看视频| 欧美一区二区日韩| 久久婷婷久久一区二区三区| 国产欧美综合在线观看第十页| 久久精品人人做人人综合| 中文字幕一区二区三| 樱桃国产成人精品视频| 日韩二区在线观看| 国产午夜精品一区二区| 国产精品女同互慰在线看| 亚洲免费观看高清| 日韩影院免费视频| 国产精品一级在线| 成人国产精品视频| 欧美妇女性影城| 国产日韩欧美一区二区三区综合| 国产精品视频免费| 日本欧美在线观看| 91最新地址在线播放| 欧美电视剧在线观看完整版| 中文在线一区二区| 青草国产精品久久久久久| bt欧美亚洲午夜电影天堂| 在线不卡a资源高清| 国产欧美精品国产国产专区 | 午夜激情一区二区三区| 蜜臀av一区二区| 欧美无砖专区一中文字| 中文av一区特黄| 卡一卡二国产精品| 欧美视频中文字幕| 亚洲国产精品99久久久久久久久| 日韩美女在线视频| 国产精品久久久久久户外露出| 中文字幕一区二区三区不卡| 日本不卡一区二区三区| 91丨porny丨户外露出| 国产三级欧美三级| 国产精品911| 久久久久久久久久美女| 国产一区二区在线观看免费| 欧美精品99久久久**|