Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Which class are Methods of HttpServletRequest implemented in?

 
Arthur Clarke
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could anyone explain, please?
HttpServletRequest is Interface, so all Methods in it are abstract.
But which class are these Methods implemented in?
For example, in this code getMethod() works but where is it implemented?

Thanks in advance.
 
boyet silverio
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
possible explanation: these classes which implement the HttpServletRequest are probably internal to the servlet engine. these classes are used by the engine to create objects that contains, among others, request information. such objects are possibly instantiated as follows:
HttpServletRequest request = new class_implementing_HttpServletRequest();
just in case such a line exist, i don't know of a way however to determine the name of the instantiating class, which could indicate the actual name of the class implementing HttpServletRequest... (could probably be seen in the tomcat code(?)).
hope this helps
 
Dinesh Kumar
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Arthur,
I had a similar doubt about a week ago. Pls. see the replies to the post titled "Two questions" from me on 13th Jan. in this very forum.
Basically it's upto the container (Tomcat / Jrun or whatever) to implement these interfaces in their own way. they just have to abide by the contract that the Servlet spec. for that interface requires.
If you are interested, you can even see the actual name of the class by using getClass() & getName() methods of Object & Class respectively.
See the code below:

Now, you can test this code with say the request object like this:
req.getClass().getName(), where "req" is the name of the parameter to the doGet or doPost method in the example that you can write yourself.
Hope this helps.
...Dinesh
 
boyet silverio
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<quote>
... using getClass() & getName() methods ...
</quote>
Dinesh, before now, i thought that these methods show the reference type rather than the instantiating type. found out otherwise. Big Thanks to you and Arthur.
 
Arthur Clarke
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dinesh and boyet, a thousand thanks for your answers.
I found out the name of that mystery class. For Tomcat/3.2.1
it is: org.apache.tomcat.facade.HttpServletRequestFacade
and for Tomcat/4.0.6: org.apache.catalina.servlets.InvokerHttpRequest

[ January 18, 2003: Message edited by: Arthur Clarke ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic