Here you can find the source of getRequest(URLConnection conn)
private static void getRequest(URLConnection conn) throws Exception
//package com.java2s; //License from project: Open Source License import java.net.*; public class Main { public static boolean useStdHeaders = false; static final String stdReqHdr[] = { // "Connection", "Keep-Alive", "User-Agent", "Mozilla/4.5 [en] (X11; U; SunOS 5.6 sun4u)", "Accept", "image/gif, image/x-xbitmap, image/jpeg," + "image/pjpeg, image/png, */*", "Accept-Encoding", "gzip", "Accept-Language", "en", "Accept-Charset", "iso-8859-1,*,utf-8" }; private static void getRequest(URLConnection conn) throws Exception { if (useStdHeaders) for (int i = 0; i < stdReqHdr.length - 1; i++) conn.setRequestProperty(stdReqHdr[i], stdReqHdr[i + 1]); conn.setDoOutput(true);/*from www . java 2 s . c o m*/ conn.connect(); } }