⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 httpclienttimeout.java

📁 这是一个matlab的java实现。里面有许多内容。请大家慢慢捉摸。
💻 JAVA
字号:
package edu.umass.cs.mallet.projects.dex.web;import sun.net.www.http.HttpClient;import sun.net.www.MessageHeader ;import sun.net.ProgressEntry ;import java.net.*;import java.io.*;public class HttpClientTimeout extends HttpClient{    public HttpClientTimeout(URL url, String proxy, int proxyPort) throws IOException    {	super(url, proxy, proxyPort);    }        public HttpClientTimeout(URL url) throws IOException    {	super(url, null, -1);    }        public void SetTimeout(int i) 	throws SocketException     { 	this.timeout = i;	serverSocket.setSoTimeout(i) ;     }         public boolean parseHTTP(MessageHeader header, ProgressEntry entry) 	throws java.io.IOException     { 	if( this.timeout != -1 ) { 	    try { 		serverSocket.setSoTimeout(timeout) ;	    } catch( SocketException e ) { 		throw new java.io.IOException("unable to set socket timeout!") ; 	    } 	} 		return super.parseHTTP(header, entry) ;     }         /* This class has no public constructor for HTTP.  This method is used to     * get an HttpClient to the specifed URL.  If there's currently an     * active HttpClient to that server/port, you'll get that one.     *     * no longer syncrhonized -- it slows things down too much     * synchronize at a higher level     */    public static HttpClientTimeout GetNew(URL url)  	throws IOException {	/* see if one's already around */	HttpClientTimeout ret = (HttpClientTimeout) kac.get(url);	if (ret == null) {	    ret = new HttpClientTimeout (url);  // CTOR called openServer()	} else {	    ret.url = url;	}	// don't know if we're keeping alive until we parse the headers	// for now, keepingAlive is false	return ret;    }        public void Close() throws IOException    {	serverSocket.close();    }        public Socket GetSocket()    {	return serverSocket;    }        int timeout;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -