• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frank,
Thank you very much! I got it
 
shivam tripathi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 30
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I understood is It's servlet container responsibility to write the class that implements HttpServletRequest interface for capturing request from Browser.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic