• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HttpServletRequest object

 
Ranch Hand
Posts: 238
1
Eclipse IDE Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 530
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
reply
    Bookmark Topic Watch Topic
  • New Topic