Who Knows All.. ?

If the answer is No one. Then this blog is for U. I'm going to put all the things I know in Java

Prerequisite for J2EE

Things you should know before learning J2EE are inserted into this post. Hope you like it.


TCP is responsible for making sure a file sent from one network node to another ends up as a complete file at the destination, even though another on their way to destination.


HTTP is another network protocol that has web-specific features, but it depends on TCP/IP to get the complete request and response from one place to another. The structure of an HTTP conversation is a simple Request/Response sequence; a browser requests and a server responds.

Server’s Job:

  • A web server takes a client request and gives something back to the client.
  • The server uses HTTP to send HTML to the client.

Client’s Job:

  • A web client lets the user request something on the server, and shows the user the result of the request.
  • HTML tells the browser how to display the content to the user

HTTP Response:

A HTTP response can contain HTML. HTTP adds header information to the top of whatever content is in the response(in other words, the thing coming back from the server). An HTML browser uses the header info to help process the HTML Page.

HTTP Request:

The first thing you’ll find is an HTTP method name. These aren’t java methods, but the idea is similar. The method name tells the server the kind of the request that’s being made, and how the rest of the message will be formatted. The HTTP protocol has several methods, but the one’s you will use most often are GET and POST. (More details about  request is in the rest of the post ).

–> GET is a simple request, POST can send user data.

GET method:

GET is the simplest HTTP method, and its main job in life is to ask the server to get a resource and send it back. That resource might be a HTML page, a JPEG, a PDF etc. Doesn’t matter. The point of GET is to get something back from the server.

POST method:

POST is a more powerful request. It’s like a GET Plus Plus. With POST, you can request something and at the same time send form data to the server.

Other HTTP methods:

  • HEAD
  • PUT

Reasons why you use POST instead of GET include:

It’s true that you can send a little data with the HTTP GET. But you might not want to because,

  1. The total amount of characters in a GET is really limited depending on the server. If  the user types, say, a long passage into a ‘Search’ input box, the GET might work.
  2. The data you send with the GET is appended to the URL up in the browser bar, so whatever you send is exposed. Better not put a password or some other sensitive data as part of a GET.
  3. Because of  number 2 above the user can’t bookmark a form submission if you use POST instead of GET. Depending on your app, you may or may not want users to be able to bookmark the resulting request  from a form submission.

In Depth of HTTP Request:

Any HTTP method request contains 3 parts.

  1. Request Line
  2. Request Header
  3. Request Body(Optional)

1.Request Line:

The path to the resource and any parameters added to the URL are all included on the request line


GET/select/selectTaste.jsp?color=dark&taste=malty HTTP/1.1

Here GET is the HTTP method

/select/selectTaste.jsp  — is the path to the resource on the web server

?color=dark&taste=malty — in a GET request, parameters if any are appended to the first part of the request URL, starting with a “?”. Parameters are separated with an ampersand “&”

HTTP/1.1 — The protocol version that the web browser is requesting.

2.Request Header:

Request Header contains all the data of the user client(browser)

For example:

Host : wickedlysmart.com

user-Agent: Mozilla/5.0(Macintosh,U,PC Mac OS X Mach-o;en-US;vv:1.4)Gecko/200356 NetScape/7.1

Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,video/x-mng,image/png,image/jpeg

Accept language: en-US;q = 0.5

Accept Encoding : gzip,deflate

Accept-Charset: ISO-8859-1,utf-8

Keep Alive :300

Connection: Keep-Alive

Don’t Worry. These are all the things that we hardly care about.

Just have glimpse at them, so that we can get to know these are all the things that our browser sends to the server when we request for something on the website by clicking  (or) typing (or) by some other sort of thing  in request header.

3.Request Body:

When the request method type is POST, the browser send the user details in the request body.

Like for example:

When we fill a form in a website and clicks on submit button, the the entered details are sent through the request body. Because the form details may be very big and the request line only allows us to append 255 characters and also for some security issues.

The request body is optional. If the HTTP method is POST, then the request body is used to the send the user entered parameters to the server.

In Depth of HTTP Response:

Any HTTP method response contains 3 parts.

  1. Response Line
  2. Response Header
  3. Response Body(Optional)

1.Response Line:

The HTTP response line contains the protocol version that the web server is using, HTTP status code for the response, A text version of the status code.

example:     HTTP/1.1 200 OK


HTTP/1.1 — is the protocol version that the web server is using

200 — is the status code

OK — text version of the status code.

2.Response Header:

Response header contains the details about the server and the data that the server is sending.


set-Cookie : JSESSIONID = 0AAB6C8DE415; path=/testEL

content-Type : text/html

content-Text : 397

Date: thu 23 AUG 2012 03:25:40 GMT

Server : Apache- Coyote/1.1

Connection: Close

No need to remember all these.

These are all the things that we hardly care about.

Just have glimpse at them, so that we can get to know these are all the things that server sends to the browser  in request header.

The content- Type in  the response header’s value is known as MIME type. The MIME Type tells the browser what kind of data the browser is about to receive. So that the browser will know how to render it.

Notice that the MIME type value relates to the value listed in the HTTP request’s “Accept” header(Go look at the Accept Header from the request header)

3.Response Body:

It is where the actual data that we looking for lies. The server sends the data, and the browser renders the data by looking into the response body

That’s it. Hope you like it. Thanks for reading. Thanks for your time.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Browse blog by date

August 2012
« Jun    

Blog Stats

  • 1,105 hits
%d bloggers like this: