• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How does servlet container creates an HttpServletRequest object ?

 
Saurabh Kumar
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good morning/Evening to all,

I have come across a thought- how does servlet container creates an HttpServletRequest/HttpServletResponse objects as they are interfaces which can't be instantiated directly.
Does that mean there exists a class that implements all the methods declared in these interfaces and the container creates object of those classes.
 
Dag Corell
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at HttpServletRequestWrapper and HttpServletResponseWrapper.
Might be what your looking for...
 
Khaled Mahmoud
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
The service method accepts two parameters HttpServletRequest and HttpServletResponse.The container for example Tomcat, two classes,one that implements the HttpServletRequest and one that implemenmts the HttpServletRespone.The container passes to the service method an instances of the those two classes and you deal with them according to their interface types.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic