Java URL Connection addProperty(URLConnection connection)

Here you can find the source of addProperty(URLConnection connection)

Description

add Property

License

Open Source License

Declaration

public static void addProperty(URLConnection connection) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.net.URLConnection;

public class Main {
    public static void addProperty(URLConnection connection) {
        connection.addRequestProperty("Accept",
                "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/msword, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/x-silverlight, */*");
        connection.setRequestProperty("Referer", "https://9.186.10.56:8443/index.jsp");
        connection.setRequestProperty("Accept-Language", "zh-cn");
        connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
        connection.setRequestProperty("Accept-Encoding", "gzip, deflate");
        connection.setRequestProperty("User-Agent",
                "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Foxy/1; .NET CLR 2.0.50727;MEGAUPLOAD 1.0)");
        connection.setRequestProperty("Connection", "Keep-Alive");
        connection.setRequestProperty("Cache-Control", "no-cache");
    }//w w w  .j  a va2  s. com
}

Related

  1. addHeaders(Map headers, URLConnection c)
  2. addHeaders(URLConnection conn)
  3. byteArrayToURL(final byte[] bytes)
  4. closeURLClassLoader(URLClassLoader clazzLdr)
  5. createImgUrlConnection(String url)
  6. createURLClassLoader(String dirPath)