wood burning stoves 2.0*
The moose likes Servlets and the fly likes diff  b/w  generic servlet   and http servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "diff  b/w  generic servlet   and http servlet" Watch "diff  b/w  generic servlet   and http servlet" New topic
Author

diff b/w generic servlet and http servlet

ramchander yshetti
Ranch Hand

Joined: Apr 22, 2006
Posts: 97
hai,
->i working with generic servlet and httpservlet
but same output is coming.

->why we have to use httpservlet,instead of generic servlet.

->what is the diff b/w generic servlets and http servlets.

->please answer my questions, i will be grateful to you
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by yathamshetti ramchander:
hai,
->i working with generic servlet and httpservlet

Why?

->why we have to use httpservlet,instead of generic servlet.

Who said you have to?

->what is the diff between generic servlets and http servlets.

The differences can be seen here:
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpServlet.html
The methods particular to HttpServlet are listed first.
Then, the methods inherited from GenericServlet are listed.

When the servlet spec was first conceived, it's creators realized that this concept could apply to several server protocols. So, rather than add a bunch of methods to the servlet interface that would be igored by any implementation other than HTTP (such as doPost, doGet), they designed the generic servlet with no protocol specific methods. Then, when desiging a servlet interface specifically for HTTP, they inherited from this generic servlet and added HTTP specific methods.

At this time, there are no servlet implementations for protocols other than HTTP; at least none are known to me.

In other words, there is almost no point in extending GenericServlet while building web-apps.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Since this issue is brought up here quite frequently, I've added it to the ServletsFaq.
Janakiram Gattupalli
Greenhorn

Joined: Jul 30, 2006
Posts: 8
GenericServlet is designed to implement irrespective of the protocl.Let us take an example.The servlets that runs inside a web-container(http server) are called as HttpServlets.Like this if the servlet technology is implemented as part of X servers then we call it as X servlet.
ramesh kothakonda
Ranch Hand

Joined: Feb 14, 2006
Posts: 40
generic servlet is protocal independent servlet

where as the httpservlet is the http protocal dependent


The object oriented way of becoming "RICH" is by INHERITANCE<br />Whoever said money can't buy happiness, didn't know where to shop.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: diff b/w generic servlet and http servlet
 
Similar Threads
servlets
servlets
diff b/w servlets and webservices
diff b/w doGet() and servlet()
Hierarchy of Servlet Please