aspose file tools*
The moose likes Beginning Java and the fly likes HTTPServletRequest Interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "HTTPServletRequest Interface " Watch "HTTPServletRequest Interface " New topic
Author

HTTPServletRequest Interface

Tarun Oohri
Ranch Hand

Joined: Feb 20, 2013
Posts: 166
Hello EveryBody
We all know that HttpServletRequest is an Interface which extends ServletRequest Interface.
My question is that , Method such as " doGet " takes HTTPServletRequest, HTTPServletResponse as a Parameter BUT the fact is that we can not make objects of an Interface.
So, what will we pass in the doGet method as an Argument ? surely cant pass HTTPServletRequest object.
Thanks in Advance !!!
Pawel Pawlowicz
Ranch Hand

Joined: Apr 18, 2013
Posts: 592
    
  11

Tarun Oohri wrote:So, what will we pass in the doGet method as an Argument ? surely cant pass HTTPServletRequest object.

A reference to an instance of any class that implements HTTPServletRequest.
When you see a type in a method signature, you may pass to it any child of that type .
EDIT:
But you do not pass anything to this particular method because of what Ulf said below...
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39541
    
  27
You're not passing anything to it, because your code does not call those methods - they're called by the server during handling an incoming request. The server is capable of creating objects that implement those interfaces.


Ping & DNS - updated with new look and Ping home screen widget
Tarun Oohri
Ranch Hand

Joined: Feb 20, 2013
Posts: 166
Ulf Dittmer wrote:You're not passing anything to it, because your code does not call those methods - they're called by the server during handling an incoming request. The server is capable of creating objects that implement those interfaces.


Thanks Pawel & Ulf for clearing my concepts . I must say CodeRanch people are the best to make one learn java in true sense.
Thanks Tons!!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTTPServletRequest Interface
 
Similar Threads
Problem in the parameters of doGet method
doGet() and doPost()
Methods in Servlet
RequestDispatcher problem
How to capture the exceptions thrown from third party services in servlet