• Post Reply Bookmark Topic Watch Topic
  • New Topic

Generic Servlet vs HttpServlet

 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Could someone please clarify:

If I use a Generic Servlet,the ServletConfig is automatically available to me through getServletConfig().
If I use an HttpServlet,I will need to store the ServletConfig in the init method before I can call ServletConfig.
I can access a Generic Servlet's ServletContext by calling getServletContext()
But to access an HttpServlet's ServletContext I need to call getServletConfig().getServletContext()..(after manually storing the servletConfig in the httpServlet's init method)

True/False???
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HttpServlet extends GenericServlet, so whatever methods you can use in the latter, you can use in the former.
 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh....ok thanks.
 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could anyone give me an example of:

A component processed late in the request cycle that needs to send an error status code when the response has already been commited?
From SCWCD study companion,pg102

Thanks...
 
Time is mother nature's way of keeping everything from happening at once. And this is a tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!