• 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

service() method in servlet class

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am beginner in servlets and following Head First book.

The signature of service() method is like as service(HttpServletRequest request,HttpServletResponse responce){}.These two parameters of service() method are reference
variable of interface HttpServletRequest and HttpServletResponce respectively.

When Container invokes the service() method, it should must pass the object of some class which has implemented HttpServletRequest interface or HttpServletResponse interface respectively as an argument to service() method.

am I thinking in right way?
If yes,then please tell me what is the name of class which has implemented the HttpServletRequest interface and HttpServletResponse interface?
if no,then what is the parameter that Container passed as an argument to service(HttpServletRequest request,HttpServletResponse responce){} method while invoking it?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Abhinav Kumar Mishra wrote:am I thinking in right way?


Correct.

If yes,then please tell me what is the name of class which has implemented the HttpServletRequest interface and HttpServletResponse interface?


It's not important. Each container will create its own implementation. That's the beauty of interfaces -- we don't have to care!

 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:
It's not important. Each container will create its own implementation. That's the beauty of interfaces -- we don't have to care!


But if you really want to know, just get it to output the value of request.getClass().getName() and response.getClass().getName().
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic