my dog learned polymorphism*
The moose likes Tomcat and the fly likes How does a ServletRequest get created Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "How does a ServletRequest get created" Watch "How does a ServletRequest get created" New topic
Author

How does a ServletRequest get created

Barry Gold
Greenhorn

Joined: Dec 15, 2005
Posts: 22
I started looking at the class definitions for ServletRequest and I'm mystified about where you get one from. The list of "All Known Implementing Classes" for ServletRequest is ServletRequestWrapper, and similarly the only implementing class for HttpServletRequest is HttpServletRequestWrapper.

The two wrapper classes have only one constructor. That constructor requires a ServletRequest, which cannot be null.

So I downloaded the Tomcat sources and started grepping for classes that implemented ServletRequest or HttpServletRequest. *Every* single class I could find that implements the ServletRequest interface (or a subinterface) uses the same paradigm and either is or "extends" one of the above wrapper classes.

So you need to have a ServletRequest in order to create a ServletRequest.

Where does the ServletRequest come from?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Look in the connector packages.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How does a ServletRequest get created
 
Similar Threads
How to set http headers in servlet request ?
Servlet doubts continued
HttpServletRequestWrapper
Service method
Question from HF second edition