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

service() method in servlet class

Abhinav Kumar Mishra
Greenhorn

Joined: Jul 25, 2011
Posts: 6
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?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

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!


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4422
    
    8

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().
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: service() method in servlet class