Tuesday 4 December 2012

Generic HTTP Questions

Every good Java Developer should be able to answer simple HTTP questions, such as:


  1. What is the difference between POST and GET and how do they work?
    • GET is the simplest way a browser interacts with a web server, in it, the browser simply requests the contents of a specific URL. If you are using Servlets, when the browser uses a GET it ends up calling the doGet() method on the Servlet side. The data  must be encoded into a URL. Get is also the default. Very small limit (7607 characters)
    • POST is another way of the browser to interact with the web server, in this way the browser sends data to a particular URL. If you are using Servlets this will call the method doPost() on the server side. The data must be in the message body of the HTTP request. (about 8Mb of max size).

Sources:

No comments:

Post a Comment