HTTP Requests - Javastudypoint

Sunday, December 23, 2018

HTTP Requests

The requests sent by the client to a web server contains all sort of potential information it is known as HTTP Requests.
An HTTP client sends the request to a web server in the form of a request message which contains the following information.
  • Request-line
  • Requested URI (Uniform Resource Identifier)
  • Request method and Content
  • User-Agent header
  • Message body




HTTP Request Methods:

HTTP 1.1 defines the following HTTP requests methods.

1. The Get Request Method:

The Get Request is the simplest and most frequently used request method, which is used to access static resources, such as HTML documents and images. Get Request can be used to retrieve the dynamic information, by including the query parameter in the request URL. To retrieve whatever information is identified by the Request-URI, we can use the Get method.

2. The Post Request Method:

The Post request method is commonly used for accessing dynamic resources. Post request is typically used when a large amount of complex information must be sent to a server. The function of the Post method is dependent on the Request-URI. We can use Post request to upload the text or binary files.

Get vs Post:

HTTP Requests
Get vs Post


3. The Head Request Method:

Sometimes, the client only wants to view the header of a response(Content-Type or Content-Length), so send the Head request. The Head request is similar to Get request except that the server must not return a message body in the response. Head request method can be used for obtaining meta information about the entity implied by the request without transferring the entity-body itself.

4. The Put Request Method: 

The Put request method is used to put the enclosed information(the body) at the requested URL. The Put request method identifies the entity enclosed with the request. It replaces all the current representations of the target resource with the uploaded content.

5. The Delete Request Method:

The Delete request method is used to delete the resources at the requested URL. It deletes all the current representations of the target resource given by URI.
Responses to this method are not cacheable.


6. The Options Request Method:

This method requests the information about the communication option available on the request/response chain identified by the Request-URI. Responses to this method are not cacheable. This method permits the client to determine the options and/or requirements associated with a resource.

7. The Trace Request Method:

A loop-back of the request message invoked by using the Trace method. An entity must not be included in the Trace method. The client uses the Trace method to see the received input at the other end of the request chain and use it for diagnostic and testing information.

You may also like:





No comments:

Post a Comment