What are the different HTTP methods?

There are eight HTTP methods. Those are,
1)GET- Asks to get the thing (resource/file) at the requested URL.

2)POST-Asks the server to accept the body info attached to the request.

3)HEAD- Asks for only the header part of whatever a GET would return. It is just like GET but no body in the response.Gives info about the requested URL without actually getting back the real thing.

4)TRACE-Asks for a loopback of the request message, so that the client can see what is being received on the other hand, for testing and troubleshooting.

5)PUT-Says to put the enclosed info(the body) at the requested URL.

6)DELETE-Says to delete the thing(resource/file) at the requested URL.

7)OPTIONS-Asks for a list of the HTTP methods to which the thing at the requested URL can respond.

8)CONNECT-Says to connect for the purpose of tunneling.

All but one HTTP methods has a matching doXXX() in the HttpServlet. There is no mechanism in the servlet API for handling doConnect(), so it is not part of httpServlet.

No comments:

Post a Comment