This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

request - service()

 
kalle suresh
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When the request comes, service method of which class will be called by the container

1. service(HttpServletRequest, HttpServletResponse) - HttpServlet Class
2. service(ServletRequest, ServletResponse) - Generic Servlet Class

If container uses 1 (HttpServlet Class) method then, is it necessary for the container to convert the response object into an HTTP response
 
Bod Toki
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
GenericServlet:service(ServletRequest request, ServletResponse response) gets called first, then passes the request to HttpServlet:service(HttpServletRequest request, HttpServletResponse response).

Note that GenericServlet:service() is public, while the HttpServlet:service() and the doXXX() methods are protected.

If container uses 1 (HttpServlet Class) method then, is it necessary for the container to convert the response object into an HTTP response


I'm not sure of what you mean by this.
 
kalle suresh
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, In HFSJ
the diagram on page 43 (container converts the response object into an HTTP response )
and
the explanation on page 100 (the service method from the HttpServlet runs)

are contradicting.

If container uses 1 (HttpServlet Class) method then, is it necessary for the container to convert the response object into an HTTP response (Page 43).

Anyone can explain me.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic