Java HttpURLConnection Open getConnection(URL url)

Here you can find the source of getConnection(URL url)

Description

get Connection

License

Apache License

Declaration

private static HttpURLConnection getConnection(URL url) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.IOException;

import java.net.HttpURLConnection;
import java.net.URL;

public class Main {
    private static HttpURLConnection getConnection(URL url) throws IOException {
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("GET");
        conn.setDoInput(true);/*from   www  .j av a  2  s . com*/
        conn.setDoOutput(true);
        conn.setRequestProperty("Accept", "application/zip;text/html");
        return conn;
    }
}

Related

  1. getConnection(String url)
  2. getConnection(String urlStr, boolean useProxy)
  3. getConnectionCharset(HttpURLConnection connection)
  4. getConnectionStream(HttpURLConnection con)
  5. openConnection(final String urlString)
  6. openConnection(final URL url, final String requestMethod)