Is it possible to make GET & POST requests in Java or another language such that you don't care about what is returned?
As in just sending the requests but not wanting to receive any responses?Answer1:
Whether you care about the response or not, it will be sent. The HTTP protocol specifications say that it must be.
If you don't care about the response, your client could just close the connection immediately after sending the request. But the chances are that you do want to know that the request was processed (i.e. the response status) even if you don't want to look at the contents of the response message.<br /> So maybe you could send the request and request body, and read the response status and then close the connection without reading the response body. However, this has a downside. It means that you can't reuse the HTTP connection to make further requests. The next request to the same server has to open a new connection.Answer2:
You could use anynchronous HTTP requests if you don't care about the responses (that way your worker thread will not have to wait for the response to come back). See <a href="http://www.javaworld.com/javaworld/jw-03-2008/jw-03-asynchhttp.html" rel="nofollow">http://www.javaworld.com/javaworld/jw-03-2008/jw-03-asynchhttp.html</a> for some details on Asynchronous/Synchronous HTTP queries in Java. Then you can control if the anychronous thread does or does not handle the response (or any failure flagged on the communication) - as long as there were no TCP level failures on the request the connection will still be opened.Answer3:
You can't control whether or not the server returns a response. Your code is free to ignore any response it receives.Answer4:
It's pretty hard to not <em>get</em> responses because they're part of the HTTP protocol. but you can certainly <em>ignore</em> the responses.