Jsp Request Response

Request and Response Object:

When request comes from a client, it recieves two objects, Request and Response.

Request Header Information: Request contains a lot of header information. Some of them mentioned below:

1) Accept-It specifies the MIME type which clients accept.

2) Accept-Languages-It specifies the languages which clients recieve.

3) Accept-Encoding-It specifies the types of encodings that the browser knows how to handle. Values of gzip or compress are the two most common possibilities.

4) User-Agent-It gives information about client software(browser).

5) Cookie-It returns cookies to servers that previously sent them to the browser.

6) Content-Length-It is applicable to POST request and gives the size of POST data in bytes.

Response Object: It consist of three things-

Status Code

Header Information

Response Body which contains output.

Status Codes: Http status codes returned by server to the client. It is three digit integer value which gets specified as:

2**: Success

3**: Redirection

4**: Client Error

5**: Server Error

Response Header Information: Some of Http response header information are as follows:

1) Cache-control- It tells all caching mechanism from server to client whether they may cache this object.

2) Expires- It gives date and time after which the response is considered as expired.

3) Refresh- It is used to specify when response will get refreshed automatically.

4) Set-Cookie- It specifies a cookie associated with the page

5) Connection- It is used to indicate whether the server is willing to maintain as open connection to the client.