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

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

?? httpurlconnection.java

?? Http client implemented in Java
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/* * @(#)HttpURLConnection.java				0.3-3 18/06/1999 * *  This file is part of the HTTPClient package *  Copyright (C) 1996-2001 Ronald Tschal鋜 * *  This library is free software; you can redistribute it and/or *  modify it under the terms of the GNU Lesser General Public *  License as published by the Free Software Foundation; either *  version 2 of the License, or (at your option) any later version. * *  This library is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU *  Lesser General Public License for more details. * *  You should have received a copy of the GNU Lesser General Public *  License along with this library; if not, write to the Free *  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, *  MA 02111-1307, USA * *  For questions, suggestions, bug-reports, enhancement-requests etc. *  I may be contacted at: * *  ronald@innovation.ch * *  The HTTPClient's home page is located at: * *  http://www.innovation.ch/java/HTTPClient/  * */package HTTPClient;import java.io.IOException;import java.io.InterruptedIOException;import java.io.InputStream;import java.io.OutputStream;import java.io.BufferedInputStream;import java.io.ByteArrayOutputStream;import java.net.URL;import java.net.ProtocolException;import java.util.Date;import java.util.Hashtable;import java.util.Enumeration;/** * This class is a wrapper around HTTPConnection providing the interface * defined by java.net.URLConnection and java.net.HttpURLConnection. * * <P>This class is a hacked version of the HttpURLConnection class for use * with HotJava 1.1.x. It extends sun.net.www.protocol.http.HttpURLConnection * instead of java.net.HttpURLConnection, because the HotJava uses the * setInstanceFollowRedirect() method which is defined in the * sun.*.HttpURLConnection class, but only if this is an instance of the * sun.*.HttpURLConnection class (or a subclass). * * <P>One difference between Sun's HttpClient and this one is that this * one will provide you with a real output stream if possible. This leads * to two changes: you should set the request property "Content-Length", * if possible, before invoking getOutputStream(); and in many cases * getOutputStream() implies connect(). This should be transparent, though, * apart from the fact that you can't change any headers or other settings * anymore once you've gotten the output stream. * So, for large data do: * <PRE> *   HttpURLConnection con = (HttpURLConnection) url.openConnection(); * *   con.setDoOutput(true); *   con.setRequestProperty("Content-Length", ...); *   OutputStream out = con.getOutputStream(); * *   out.write(...); *   out.close(); * *   if (con.getResponseCode() != 200) *       ... * </PRE> * * <P>The HTTPClient will send the request data using the chunked transfer * encoding when no Content-Length is specified and the server is HTTP/1.1 * compatible. Because cgi-scripts can't usually handle this, you may * experience problems trying to POST data. For this reason, whenever * the Content-Type is application/x-www-form-urlencoded getOutputStream() * will buffer the data before sending it so as prevent chunking. If you * are sending requests with a different Content-Type and are experiencing * problems then you may want to try setting the system property * <var>HTTPClient.dontChunkRequests</var> to <var>true</var> (this needs * to be done either on the command line or somewhere in the code before * the first URLConnection.openConnection() is invoked). * * <P>A second potential incompatibility is that the HTTPClient aggresively * resuses connections, and can do so more often that Sun's client. This * can cause problems if you send multiple requests, and the first one has * a long response. In this case (assuming the server allows the connection * to be used for multiple requests) the responses to second, third, etc * request won't be received until the first response has been completely * read. With Sun's client on the other hand you may not experience this, * as it may not be able to keep the connection open and there may create * multiple connections for the requests. This allows the responses to the * second, third, etc requests to be read before the first response has * completed. <strong>Note:</strong> whether this will happen depends on * details of the resource being requested and the server. In many cases * the HTTPClient and Sun's client will exhibit the same behaviour. Also, * applications which depend on being able to read the second response * before the first one has completed must be considered broken, because * A) this behaviour cannot be relied upon even in Sun's current client, * and B) Sun's implementation will exhibit the same problem if they ever * switch to HTTP/1.1. * * @version	0.3-3  18/06/1999 * @author	Ronald Tschal鋜 * @since	V0.3 */public class HttpURLConnection		extends sun.net.www.protocol.http.HttpURLConnection		implements GlobalConstants{    /** a list of HTTPConnections */    private static Hashtable  connections = new Hashtable();    /** the current connection */    private HTTPConnection    con;    /** the cached url.toString() */    private String            urlString;    /** the resource */    private String            resource;    /** the current method */    private String            method;    /** has the current method been set via setRequestMethod()? */    private boolean           method_set;    /** the default request headers */    private static NVPair[]   default_headers = new NVPair[0];    /** the request headers */    private NVPair[]          headers;    /** the response */    private HTTPResponse      resp;    /** is the redirection module activated for this instance? */    private boolean           do_redir;    /** the RedirectionModule class */    private static Class      redir_mod;    /** the output stream used for POST and PUT */    private OutputStream      output_stream;    /** HotJava hacks */    private static boolean    in_hotjava = false;    static    {	try	{	    String browser = System.getProperty("browser");	    if (browser != null  &&  browser.equals("HotJava"))		in_hotjava = true;	}	catch (SecurityException se)	    { }	// The default allowUserAction in java.net.URLConnection is	// false.	try	{	    if (Boolean.getBoolean("HTTPClient.HttpURLConnection.AllowUI")  ||		in_hotjava)		setDefaultAllowUserInteraction(true);	}	catch (SecurityException se)	    { }	// get the RedirectionModule class	try	    { redir_mod = Class.forName("HTTPClient.RedirectionModule"); }	catch (ClassNotFoundException cnfe)	    { throw new NoClassDefFoundError(cnfe.getMessage()); }	// Set the User-Agent if the http.agent property is set	try	{	    String agent = System.getProperty("http.agent");	    if (agent != null)		setDefaultRequestProperty("User-Agent", agent);	}	catch (SecurityException se)	    { }    }    // Constructors    private static String non_proxy_hosts = "";    private static String proxy_host = "";    private static int    proxy_port = -1;    /**     * Construct a connection to the specified url. A cache of     * HTTPConnections is used to maximize the reuse of these across     * multiple HttpURLConnections.     *     * <BR>The default method is "GET".     *     * @param url the url of the request     * @exception ProtocolNotSuppException if the protocol is not supported     */    public HttpURLConnection(URL url)	    throws ProtocolNotSuppException, IOException    {	super(url, null);	// first read proxy properties and set        try        {            String hosts = System.getProperty("http.nonProxyHosts", "");	    if (!hosts.equalsIgnoreCase(non_proxy_hosts))	    {		connections.clear();		non_proxy_hosts = hosts;		String[] list = Util.splitProperty(hosts);		for (int idx=0; idx<list.length; idx++)		    HTTPConnection.dontProxyFor(list[idx]);	    }        }        catch (ParseException pe)	    { throw new IOException(pe.toString()); }        catch (SecurityException se)            { }	try	{	    String host = System.getProperty("http.proxyHost", "");	    int port = Integer.getInteger("http.proxyPort", -1).intValue();	    if (!host.equalsIgnoreCase(proxy_host)  ||  port != proxy_port)	    {		connections.clear();		proxy_host = host;		proxy_port = port;		HTTPConnection.setProxyServer(host, port);	    }	}	catch (SecurityException se)	    { }	// now setup stuff	con           = getConnection(url);	method        = "GET";	method_set    = false;	resource      = url.getFile();	headers       = default_headers;	do_redir      = getFollowRedirects();	output_stream = null;	urlString     = url.toString();    }    /**     * Returns an HTTPConnection. A cache of connections is kept and first     * consulted; only when the cache lookup fails is a new one created     * and added to the cache.     *     * @param url the url     * @return an HTTPConnection     * @exception ProtocolNotSuppException if the protocol is not supported     */    private HTTPConnection getConnection(URL url)	    throws ProtocolNotSuppException    {	// try the cache, using the host name	String php = url.getProtocol() + ":" + url.getHost() + ":" +		     ((url.getPort() != -1) ? url.getPort() :					URI.defaultPort(url.getProtocol()));	php = php.toLowerCase();	HTTPConnection con = (HTTPConnection) connections.get(php);	if (con != null)  return con;	// Not in cache, so create new one and cache it	con = new HTTPConnection(url);	connections.put(php, con);	return con;    }    // Methods    /**     * Sets the request method (e.g. "PUT" or "HEAD"). Can only be set     * before connect() is called.     *     * @param method the http method.     * @exception ProtocolException if already connected.     */    public void setRequestMethod(String method)  throws ProtocolException    {	if (connected)	    throw new ProtocolException("Already connected!");	Log.write(Log.URLC, "URLC:  (" + urlString + ") Setting request method: " +			    method);	this.method = method.trim().toUpperCase();	method_set  = true;    }    /**     * Return the request method used.     *     * @return the http method.     */    public String getRequestMethod()    {	return method;    }    /**     * Get the response code. Calls connect() if not connected.     *     * @return the http response code returned.     */    public int getResponseCode()  throws IOException    {	if (!connected)  connect();	try	{	    if (in_hotjava  &&  resp.getStatusCode() >= 300)	    {		try		    { resp.getData(); }	// force response stream to be read		catch (InterruptedIOException iioe)		    { disconnect(); }	    }	    return resp.getStatusCode();	}	catch (ModuleException me)	    { throw new IOException(me.toString()); }    }    /**     * Get the response message describing the response code. Calls connect()     * if not connected.     *     * @return the http response message returned with the response code.     */    public String getResponseMessage()  throws IOException    {	if (!connected)  connect();	try	    { return resp.getReasonLine(); }	catch (ModuleException me)	    { throw new IOException(me.toString()); }    }    /**     * Get the value part of a header. Calls connect() if not connected.     *     * @param  name the of the header.     * @return the value of the header, or null if no such header was returned.     */    public String getHeaderField(String name)    {	try	{	    if (!connected)  connect();	    return resp.getHeader(name);	}	catch (Exception e)	    { return null; }    }    /**     * Get the value part of a header and converts it to an int. If the     * header does not exist or if its value could not be converted to an     * int then the default is returned. Calls connect() if not connected.     *     * @param  name the of the header.     * @param  def  the default value to return in case of an error.     * @return the value of the header, or null if no such header was returned.     */    public int getHeaderFieldInt(String name, int def)    {	try	{	    if (!connected)  connect();	    return resp.getHeaderAsInt(name);	}	catch (Exception e)	    { return def; }    }    /**     * Get the value part of a header, interprets it as a date and converts     * it to a long representing the number of milliseconds since 1970. If     * the header does not exist or if its value could not be converted to a     * date then the default is returned. Calls connect() if not connected.     *     * @param  name the of the header.     * @param  def  the default value to return in case of an error.     * @return the value of the header, or def in case of an error.     */    public long getHeaderFieldDate(String name, long def)    {	try	{	    if (!connected)  connect();	    return resp.getHeaderAsDate(name).getTime();	}	catch (Exception e)	    { return def; }    }    private String[] hdr_keys, hdr_values;    /**     * Gets header name of the n-th header. Calls connect() if not connected.     * The name of the 0-th header is <var>null</var>, even though it the     * 0-th header has a value.     *     * @param n which header to return.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人av免费在线观看| 国产精品99久久久久久久女警| 国产老女人精品毛片久久| 欧美性色黄大片| 国产日产精品1区| 日产欧产美韩系列久久99| 99精品热视频| 国产校园另类小说区| 蜜桃在线一区二区三区| 欧美亚洲日本国产| 中文字幕中文字幕在线一区 | 亚洲国产精品一区二区久久恐怖片| 国产在线视频不卡二| 欧美精品日日鲁夜夜添| 亚洲免费观看视频| 成人激情免费电影网址| 欧美成人福利视频| 奇米色一区二区三区四区| 欧美在线你懂得| 亚洲黄色小视频| 波多野结衣中文一区| 久久久久国产一区二区三区四区| 蜜桃一区二区三区四区| 91精品国产日韩91久久久久久| 亚洲午夜免费电影| 欧美做爰猛烈大尺度电影无法无天| 国产精品久久久久久妇女6080| 国产毛片精品国产一区二区三区| 欧美成人福利视频| 久久精品噜噜噜成人88aⅴ| 欧美喷潮久久久xxxxx| 亚洲一区二区三区中文字幕 | 免费人成在线不卡| 欧美精选在线播放| 图片区小说区国产精品视频| 在线亚洲+欧美+日本专区| 亚洲人成网站精品片在线观看| 成人免费高清在线观看| 国产日韩欧美不卡在线| 成人永久aaa| 中文字幕在线不卡一区| av激情亚洲男人天堂| 国产精品传媒视频| 色综合久久综合| 一区二区三区91| 欧美写真视频网站| 五月婷婷激情综合网| 在线播放/欧美激情| 日本特黄久久久高潮 | 成人综合婷婷国产精品久久蜜臀| 国产清纯白嫩初高生在线观看91 | 成人性色生活片| 中文字幕第一区第二区| 99精品视频在线免费观看| 亚洲日本在线a| 欧美又粗又大又爽| 日韩国产欧美视频| 精品国产91乱码一区二区三区 | 91污在线观看| 亚洲在线中文字幕| 欧美精品久久99久久在免费线 | 亚洲男女毛片无遮挡| 色婷婷av久久久久久久| 午夜激情久久久| 日韩免费一区二区三区在线播放| 国产乱码精品一区二区三| 国产精品久久久久一区二区三区| 91麻豆成人久久精品二区三区| 亚洲午夜免费视频| 欧美电影免费提供在线观看| 国产91精品免费| 樱花草国产18久久久久| 日韩一区二区三区免费看 | 成人av资源在线| 亚洲伊人色欲综合网| 7777精品久久久大香线蕉| 国产一本一道久久香蕉| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 欧美视频精品在线| 国产在线精品一区二区不卡了| 中文字幕中文字幕一区二区| 欧美日本在线播放| 国产成人在线色| 亚洲国产裸拍裸体视频在线观看乱了| 欧美一区二区久久久| 丁香桃色午夜亚洲一区二区三区| 亚洲丝袜美腿综合| 欧美一卡二卡在线| 成人av第一页| 日韩激情av在线| 国产精品久久久久久久久动漫| 欧美日韩一区在线观看| 国产一区二区美女诱惑| 一区二区三区久久| 久久亚洲捆绑美女| 在线观看免费亚洲| 国产成人综合视频| 亚洲va欧美va人人爽| 国产日韩精品一区二区三区在线| 欧美日韩一级二级三级| 成人性生交大片免费看中文| 亚洲1区2区3区4区| 欧美激情在线观看视频免费| 欧美日韩综合不卡| 成人h精品动漫一区二区三区| 日韩av电影免费观看高清完整版 | 欧美电影免费观看完整版 | 久久99精品国产麻豆婷婷洗澡| 亚洲欧美怡红院| 精品国产自在久精品国产| 欧美性大战久久久久久久蜜臀| 国产91在线观看| 免费看欧美美女黄的网站| 亚洲视频一二区| 国产亚洲欧美一级| 日韩色在线观看| 在线免费观看成人短视频| 国产成人亚洲综合a∨婷婷| 亚洲成av人片www| 国产欧美日韩不卡免费| 日韩手机在线导航| 欧美亚州韩日在线看免费版国语版| 丰满少妇久久久久久久| 精品一区二区三区欧美| 日韩黄色片在线观看| 亚洲一区二区四区蜜桃| 欧美国产日韩精品免费观看| 欧美成人精品二区三区99精品| 欧美视频日韩视频在线观看| 成人激情av网| 国产精品一区二区果冻传媒| 裸体一区二区三区| 性做久久久久久久久| 亚洲精品五月天| 国产精品久久一级| 欧美经典三级视频一区二区三区| 欧美成人video| 欧美一区欧美二区| 精品视频123区在线观看| 日本高清无吗v一区| 99久久精品国产导航| 成人激情免费视频| 成人av午夜影院| 丰满放荡岳乱妇91ww| 粉嫩av一区二区三区| 国产精品 欧美精品| 国产麻豆日韩欧美久久| 韩国av一区二区| 国产一区二区三区| 国产一区三区三区| 国产精品一区二区男女羞羞无遮挡 | 欧美一二三区在线| 91精品欧美综合在线观看最新| 欧美精品三级在线观看| 欧美老肥妇做.爰bbww视频| 欧美视频在线不卡| 欧美日韩国产一级二级| 欧美少妇xxx| 51精品秘密在线观看| 欧美精品高清视频| 日韩亚洲欧美综合| 欧美一区二区视频在线观看2022| 欧美一区二区三区性视频| 日韩午夜三级在线| 亚洲精品在线网站| 国产三级精品视频| 国产精品黄色在线观看| 亚洲欧美日本在线| 99精品国产视频| 日本道精品一区二区三区| 在线观看91精品国产入口| 欧美另类久久久品| 日韩三级视频中文字幕| 久久免费的精品国产v∧| 欧美激情在线一区二区| 亚洲天堂久久久久久久| 伊人色综合久久天天| 性做久久久久久免费观看| 蜜臀99久久精品久久久久久软件| 国产一区二区三区黄视频| 成av人片一区二区| 91高清视频免费看| 欧美一区二区三区白人| 久久久www免费人成精品| 国产精品国产精品国产专区不蜜| 成人av小说网| 欧美日韩另类一区| 26uuu精品一区二区| 日韩美女精品在线| 丝袜美腿亚洲综合| 国产乱国产乱300精品| 一本大道综合伊人精品热热| 欧美麻豆精品久久久久久| 精品99一区二区三区| 亚洲特黄一级片| 久久国产精品99久久人人澡| eeuss鲁片一区二区三区在线观看| 欧美在线观看一区| 精品国产91乱码一区二区三区| 国产精品视频看|