Oh. Thought the URLConnection does that for you, like make sure all the default headers are set for you.
I realize that no headers are set for you. :\
GConnection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; H010818)");
Map<String, List<String>> properties = GConnection.getRequestProperties();
for (String s : properties.keySet())
System.out.printf("%s: %s%n", s, properties.get(s));
I was wondering, is this how you would send cookies too?
Here is the API on java cookie
I believe the method: setRequestProperty
can set some request header fields.