Good code is its own documentation. As you are about to add a comment, ask yourself, ‘How can I improve the code so that this comment isn’t needed?’ ~ Steve McConnell
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 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. Here is the code.
Once you are done creating the servlet with the above code, run it in you server and if everything goes right you should get the following result depending on your system.