Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Head First page no 43

 
anil kumar
Ranch Hand
Posts: 447
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

These Statements are from Head First Book.

In the 2nd figure

They said the container creates

1)HttpServletRequest
2)HttpServletResponse

In the 6th figure they said

The thread Completes ,the container converts the response object into Http response,sends it back to the clients,then deletes the request and response object

Is this true, the container again converts the response object to Http response ?

Because the container creates the HttpServletRequest and HttpServletResponse objects.So why to convert into Http response?

I think the 6 th figure statement is wrong.

Can any one tell me wheather it is right or wrong.

Thanks

Anil Kumar
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HttpServletResponse object is not understood by the browser. As requests comes
the HttpServletRequest object is populated with HTTP data sent from the
browser, in the same way HttpServletResponse is converted to browser friendly
HTTP response before forwarding.



Thanks,
 
anil kumar
Ranch Hand
Posts: 447
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

What do you mean by browser friendly?


Thanks

Anil Kumar
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You know container generates two objects HttpServletRequest and
HttpServletResponse. And before passing them to the service method,
container fills the HTTP request data into the request object.

Client HTTP request that is in the form like:

GET http://www.osborne.com/index.html HTTP/1.1
Accept: image/*, application/vnd.ms-excel, */*
Accept-Language: en-gb
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Host: www.osborne.com
Connection: Keep-Alive


This information is little typical to work with until we have certain
API methods to access.
This information is used by the container to populate HttpServletRequest
object for you. You can get the HTTP sent data using APIs. OK?

In the response the browser expects the information that is understood by
it and NOT what is friendly to you (Objects and APIs).

Conversion of HttpServletResponse object to this format is friendly to
the browser:


HTTP/1.0 200 OK
Connection: Close
Date: Fri, 02 May 2003 15:30:30 GMT
Set-Cookie: PREF=ID=1b4a0990016089fe:LD=en:TM=1051889430:
LM=1051889430:
S=JbQnlaabQb0I0KxZ; expires=Sun, 17-Jan-2038 19:14:07 GMT;
path=/; domain=.google.co.uk
Cache-control: private
Content-Type: text/html
Server: GWS/2.0
[BLANK LINE]
"<html><head><meta HTTP-EQUIV="content-type" CONTENT="text/html;
charset=UTF-8"><title>Google Search: MIME </title>
etc. etc. rest of web page


Thanks,
[ August 16, 2007: Message edited by: Chandra Bhatt ]
 
anil kumar
Ranch Hand
Posts: 447
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Thanks


Thanks

Anil Kumar
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic