In the code:
HttpURLConnection connection = (HttpURLConnection)createMerchURL.openConnection();
connection.setRequestMethod("PUT");
connection.addRequestProperty("Name", "Value1");
connection.connect();
..
connection.disconnect();
When is the connection getting opened actually? At
..createMerchURL.openConnection();
? or atconnection.connect();
?How can I set URL in the
connection
Object and use it withconnection.connect()
?(as I am less comfortable with.openConnection()
)
Finally, is there any difference between the two?
Thanks..