Java : Send cookie with HttpURLConnection

This is an example of how to send a cookie with an HttpURLConnection request in Java

URL url = new URL("http://www.google.com");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
// Set the cookie value to send
conn.setRequestProperty("Cookie", "name1=value1; name2=value2");
// Send the request to the server
conn.connect();

This was an example of how to send cookies with HttpURLConnection requests in Java.



Comments

Popular posts from this blog

Byobu : Japanese term for decorative