Http Request Class Tutorial

400 views
327 views

Published on

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
400
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Http Request Class Tutorial

  1. 1. Introduction  When a browser requests for a web page, it sends lot of information to the web server which can not be read directly because this information travel as a part of header of HTTP request.  Following is the important header information which comes from browser side and you would use very frequently in web programming
  2. 2. Reading Header Information  Following is the example which uses getHeaderNames() method of HttpServletRequest to read the HTTP header information.  This method returns an Enumeration that contains the header information associated with the current HTTP request.  Once we have an Enumeration, we can loop down the Enumeration in the standard manner, using hasMoreElements() method to determine when to stop and using nextElement() method to get each parameter name.
  3. 3. HTTP Header Request Output Header Name Header Value(s) accept */* accept-language en-us user-agent Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; InfoPath.2; MS-RTC LM 8) accept-encoding gzip, deflate host localhost:8080 connection Keep-Alive cache-control no-cache

×