Reputation: 1451
I have read in HttpServlet documentation that
A subclass of HttpServlet must override at least one method, usually one of these:
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
What rule that helps compiler in checking that any one of the above method is overrided in subclass?
Upvotes: 0
Views: 566
Reputation: 1109182
Nothing. You (actually, the enduser) will just face a HTTP 405 Method Not Implemented error when requesting the servlet using a non-overridden HTTP method, because that's what the default implementation does.
Upvotes: 3
Reputation: 425198
All of those methods are protected
. The compiler can't require that the subclass override "at least one of them".
It just wouldn't make sense not to, because you would have a "not implemented explosion" servlet.
Upvotes: 0