Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending GET & POST requests in Java or other without responses

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?

like image 339
Justin Avatar asked Dec 23 '11 04:12

Justin


People also ask

What is HTTP GET?

An HTTP command used to request a file from a Web server. GET is widely implemented in HTML files (Web pages) for making database queries that do not involve any updating at the server side.

How do you use GET method?

The GET MethodGET is used to request data from a specified resource. Some notes on GET requests: GET requests can be cached. GET requests remain in the browser history.

What is in a GET request?

A GET request, in simple terms, is a way for you to grab data from a data source with the help of the internet. It's done using the GET request method, which is a very common HTTP request method (like POST, PUT, or DELETE). Despite the capitalization, “GET” is not an acronym, so it doesn't stand for anything.

What is difference between GET and POST?

Both GET and POST method is used to transfer data from client to server in HTTP protocol but Main difference between POST and GET method is that GET carries request parameter appended in URL string while POST carries request parameter in message body which makes it more secure way of transferring data from client to ...


1 Answers

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.
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.

like image 164
Stephen C Avatar answered Oct 25 '22 10:10

Stephen C