Why HttpServlet class is declared as abstract even there is no abstract method in that class?
Why HttpServlet class is declared as abstract even there is no abstract method in
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s because it follows the Template Method design pattern. The
doXxx()methods have all default behaviours of returning a HTTP 405 Method Not Implemented error. If those methods were all abstract, you would be forced to override them all, even though your business requirements don’t need it at all. It would only result in boilerplate code and unspecified/unintuitive behaviour.