Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Try Apache <a href="http://hc.apache.org/" rel="nofollow">HTTPClient</a>. I hope all the imports are included as this code is not tested as it is... Also your 30s is the connection timeout of your client.</p> <pre><code>import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.InetSocketAddress; import java.net.Proxy; import java.net.ProxySelector; import java.net.SocketAddress; import java.net.URI; import org.apache.http.HttpHost; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.conn.params.ConnRoutePNames; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.params.CoreConnectionPNames; public class URLReader { public static void main(String[] args) throws Exception { HttpClient httpclient = new DefaultHttpClient(); httpclient.getParams().setParameter( CoreConnectionPNames.CONNECTION_TIMEOUT, timeOut); httpclient.getParams().setParameter( CoreConnectionPNames.SO_TIMEOUT, 2 * timeOut); httpclient.getParams().setParameter( CoreConnectionPNames.STALE_CONNECTION_CHECK, false); httpclient.getParams().setParameter( CoreConnectionPNames.TCP_NODELAY, true); HttpHost proxy = new HttpHost(%proxyhost%, %proxyport%); HttpGet httpget = new HttpGet("http://www.oracle.com"); HttpResponse resp = httpclient.execute(httpget); respCode = resp.getStatusLine().getStatusCode(); BufferedReader br = new BufferedReader(new InputStreamReader(resp .getEntity().getContent())); String line = null; while ((line = br.readLine()) != null) { System.out.println(line); } br.close(); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload