Books Related to Java, Core Java, Jquery, Web Services, SCJP, Spring, Hibernate and J2ME

Monday, April 27, 2009

Web Server Request

Each request must internally specify which method of returning data to the web server is being used. the three most commonly used methods, specified within the request are:

1. HEAD
2. GET
3. POST

The HEAD method is simply retrieves information about a document and not the document itself. It is very identical to the GET method except that the web server returns no user data.
The GET and POST methods are the ones that are use to issue request to execute a web server side program. While they both accomplish the same task, their methods of doing so are quite different.
The GET Method

In the GET method , all of the form data that has been captured is appended to the request string when a GET request is issued. The data is appended to the request string using key =value pairs. A GET request that looks like:
http://www.worldinfosoft.com/captainganj/example.jsp?name= AnilSingh&age=23&qule=mcalko

would execute a script named example.jsp available in the captainganj directory of the www.worldinfosoft.com domain and pass it a value of AnilSingh which will be held in side the variable name and mcalko which will be held inside the variable show.

Note: The default method used by Browsers for all web requests is the GET method. The response to GET method is cacheable. This means that if some previous results for the request URL exist in the cache, then the older results might be displayed which might not be what is expected by the person who write the program.

Another potential problem with using the GET method is that the total amount of the data can be streamed to the web server is limited to 1024 bytes.
since it has to encoded in to the URL.
The POST Method

In the POST method , the browser use the POST command to submit the data to the web server and includes the form data as part of the request body. The web server read the data from the input files and parses out the variable names an values.

Note: The POST method allows as much data as a required to the passed to the web server because the browser sends the data as a separate text data stream to the web server.
Different Between GET/POST Method

GET Method
1: The GET method send the data to the web server in the limited size. The limited size is 1024 bytes.
2: The execution time of the GET method is very fast then the POST method.
3: The GET method is not grater secure then the POST method.

POST Method
1: The POST method send the data to the web server in the unlimited size (more then 1024 bytes ).
2: The execution time of POST method is slow then GET method.
3: The POST method is much more secure because the query data send the encrypted form.

No comments:

Post a Comment