connection.setRequestProperty and excplicitly writing to the urloutputstream are they same ?

Posted by Bunny Rabbit on Stack Overflow See other posts from Stack Overflow or by Bunny Rabbit
Published on 2010-04-01T12:06:43Z Indexed on 2010/04/01 12:13 UTC
Read the original article Hit count: 183

Filed under:
|

URL url = new URL("http://www.example.com/comment"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setRequestMethod("POST");

Is

connection.setRequestProperty(key, value);

same as

OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
            writer.write("key=" + value);
            writer.close();

if not please correct me .

© Stack Overflow or respective owner

Related posts about java

Related posts about url