http://www.hccp.org/java-net-cookie-how-to.html

Same way you can set other headers like Content-Type, Accept to the HTTP request using the setRequestProperty method of URLConnection