I´m trying to send a post request with cookies. This is the code:
try {
String query = URLEncoder.encode(\"key\", \"UTF-8\") + \"=\" + URLEncoder.encode(\"v
According to the URLConnection
javadoc:
The following methods are used to access the header fields and the
contents AFTER the connection is made to the remote object:
* getContent
* getHeaderField
* getInputStream
* getOutputStream
Have you confirmed that in your test case above the request is getting to the server at all? I see you have the call to connect()
after getOutputStream()
and commented-out besides. What happens if you uncomment it and move up before the call to getOutputStream()
?