Here you can find the source of getDefaultUrlConnection(URL url)
private static URLConnection getDefaultUrlConnection(URL url) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.net.URL; import java.net.URLConnection; public class Main { private static URLConnection getDefaultUrlConnection(URL url) throws IOException { final URLConnection connection = (URLConnection) url.openConnection(); connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31"); return connection; }//www. ja v a 2 s.c o m }