aspose file tools*
The moose likes Servlets and the fly likes HttpServletRequest object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "HttpServletRequest object" Watch "HttpServletRequest object" New topic
Author

HttpServletRequest object

Sudhanshu Mishra
Ranch Hand

Joined: May 28, 2011
Posts: 217

Hi all,
I am new to servlet programming.I want to know that how is the request processed by a doxxx method of servlet.HttpServletRequest is an interface,but how is then an object of HttpServletRequest passed to the doxxx method ?Does the container implicitly creates the object of HttpServletRequest?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12789
    
    5
Yes, it is the responsibility of the container to create both request and response objects, parse the request headers and decide which servlet's service method to call. All of this happens before your code even knows a request is coming.

Assuming your servlet extends HttpServlet - the usual case - you don't have to implement the service method - the default service looks at the requested method and calls doGet, doPost etc. - see the javax.servlet.http.HttpServlet javadocs.

Bill
Nam Ha Minh
Ranch Hand

Joined: Oct 31, 2011
Posts: 498

Sudhanshu Mishra wrote:Hi all,
I am new to servlet programming.I want to know that how is the request processed by a doxxx method of servlet.HttpServletRequest is an interface,but how is then an object of HttpServletRequest passed to the doxxx method ?Does the container implicitly creates the object of HttpServletRequest?


The servlet container must supply objects that implement the HttpServletRequest and HttpServletResponse interfaces and injects them into the doXXX methods. The implementation might be different among different containers, but all should follow the servlet specification.


PM Me If You Want to get Urgent Help on Java Programming
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HttpServletRequest object