Meaningless Drivel is fun!
The moose likes Servlets and the fly likes implementation of interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "implementation of interface" Watch "implementation of interface" New topic

implementation of interface

padmaratna kamble

Joined: Apr 26, 2006
Posts: 26
hi friends .......
please tell me, in servlet we use HttpServletRequest to get
data Comming from clint. we use

and i know Container create object of HttpServletRequest, but how ?.
we know interface does not have method body , how containter know that this method is for to get request parameter from client
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
The container creates an instance of some class that implements HttpServletRequest. We don't have to know exactly what class that is. Knowing that it implements the interface is enough because that guarantees the methods we want to use will be there.

If you look at your request.getClass().getName() you'll likely find the container vendor in the package path. When someone decides to write a container, they have to provide implementations of many such interfaces. The behavior they have to provide is so well defined by the spec that we can move code from one container to another, one concrete implementation class to another, and it all still works. Very cool.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link:
subject: implementation of interface
It's not a secret anymore!