Hello everybody, I am wonderring what makes the class javax.servlet.HttpServlet abstract? It seems like the public service method is implemented as it dispatch to the protected service method. And it seems like the protected method is also implemented as it dispatch to a doXxx method. It seems also that all the doXxx method have at least an empty body as overriding only one of them is enough. So what makes that class abstract? Is there any reason for calling that class abstract? Thx for your help!
By constantly trying one ends up succeeding. Thus: the more one fails the more one has a chance to succeed.
You can not use it as is. You have to sub-class it and override one of the following: doGet, if the servlet supports HTTP GET requests doPost, for HTTP POST requests doPut, for HTTP PUT requests doDelete, for HTTP DELETE requests init and destroy, to manage resources that are held for the life of the servlet getServletInfo, which the servlet uses to provide information about itself
Looks like they want to guide you to use the public and protected service methods the way they are (deciding which method to call based on the HTTP method) but giving you the freedom to implement the doXxx() ones to fulfill the requests. At the same time they don't want you to use an HttpServlet object since it won't do a thing with the request. In other words, they want HttpServlet to serve as a template for you own HTTP servlets, not as a real servlet handling requests. This is just an opinion of course.