• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

diff b/w generic servlet and http servlet

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since this issue is brought up here quite frequently, I've added it to the ServletsFaq.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
generic servlet is protocal independent servlet

where as the httpservlet is the http protocal dependent
 
Stop it! You're embarassing me! And you are embarrassing this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic