This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes  which class implements  HttpServletRequest  interface  in javax.servlet.http package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark " which class implements  HttpServletRequest  interface  in javax.servlet.http package" Watch " which class implements  HttpServletRequest  interface  in javax.servlet.http package" New topic
Author

which class implements HttpServletRequest interface in javax.servlet.http package

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Dear all;
I just checked package javax.servlet.http at http://java.sun.com/products/servlet/2.1/api/Package-javax.servlet.http.html. However,
I can not find any classes(including Cookie,HttpServlet,HttpSessionBindingEvent,and htppUtils) to implement interface (including HttpServerRequest,HttpServerResponse,Httpseeionbinding HttpSession,and HttpSessionContext ). where can i find the all
methods in HttpServerRequest interface implemented by other classes??
any replay would be great appreciated!

Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
I don't think you will find any classes which implement these interfaces in the standard APIs. These imterfaces are intended to be implemented by the servlet container, not the servlet.
Imagine a very simple web server. It has a class which listens on a port, and each time it gets an incoming connection it wants to run a servlet. How does it do it? It creates a Request object and a Response object, based on the port and the details of the HTTP request. Once these objects have been created, they are passed to the "service" method of the associated servlet.
There is no "standard" implementation of these classes, all the servlet knows is that they conform to the appropriate interfaces. In some implementations I have seen, the two objects are actually the same one, it just implements all the methods from both interfaces.
For "official" versions of classes which implement these interfaces you should see the Tomcat reference source code, but note that they will probably only work in the Tomcat server. Similar classes will be available in any open-source Java Servlet container.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
HI, Frank
thank you very much for your detailed explainnation. But I am still not clear about " servlet container". Does it mean Web Server such as IIS4 or Nescapter web server??. I successfully plug Jrun into IIS4 ,and I wotks pretty well. According to my knowledge of Servlet, "servlet contrainr" should be JCP(Jrun Connection Proxy server) because web server doesn't know how to creat the " both Request object and Response object". the Web server only transers the client request(browser) to JCP, and then JCP which implements the interface ServerRequest,HttpServerResponse create ServerRequest and ServlerResponce objects, after that JCP Pass these two objects to
JSE(Jrun Servlet Engine for JCP), then JSE invoke the Servlet Object and fufills all of tasks which the browser request......
...
If I am worng, please correct me
many thanks!!
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi, Frank
some words are spelling error: see follwoing correction:
error:and I wotks pretty well.
coorect: and It works prety wll
Because other guy called Mike, so I call myself Smaller mike
thank you for your attention, Hope you can reply to me
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
"Servlet Container" is the official term for what used to be called a "servlet engine". It is the software which provides the environment for servlets to execute in. In your case, that would be JRun. There are plenty of others, some free, some low cost and some expensive.
Some Servlet containers work closely with specific web servers (JServ works clsoely with Apache, Gefion produce one specific to Netscape Enterprise Server etc.), some plug in to various web servers (JRun and ServletExec are well known and work with many of the major servers) and some include their own web server (Jetty, Tomcat, Resin, LiteWebServer, and many more)
When choosing a Servlet container you need to check which version of the servlet API it supports. The Servlet API is currently at version 2.2, and if you want to use the features privided in 2.2 (such as web applications and WAR files, request dispatching etc.) you will need a compatible servlet container.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Frank,
Thank you very much! I got it
shivam tripathi
Greenhorn

Joined: Dec 29, 2012
Posts: 1
Anonymous wrote:Dear all;
I just checked package javax.servlet.http at http://java.sun.com/products/servlet/2.1/api/Package-javax.servlet.http.html. However,
I can not find any classes(including Cookie,HttpServlet,HttpSessionBindingEvent,and htppUtils) to implement interface (including HttpServerRequest,HttpServerResponse,Httpseeionbinding HttpSession,and HttpSessionContext ). where can i find the all
methods in HttpServerRequest interface implemented by other classes??
any replay would be great appreciated!





Implementation class of HttpServletRequest interface is HttpServletRequestWrapper and implementation class for HttpServletResponse is HttpServletResponseWrapper.
mak pandian
Ranch Hand

Joined: Jul 06, 2011
Posts: 30

What I understood is It's servlet container responsibility to write the class that implements HttpServletRequest interface for capturing request from Browser.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: which class implements HttpServletRequest interface in javax.servlet.http package
 
Similar Threads
Which one is correct?
getRequestDispatcher method
logging on session timeout/destruction ?
HttpSessionEvent.class is a pre-defined class or what?
regarding packages