tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Angel Java Lopez <ajlopez2...@gmail.com>
Subject Re: Why isn't the doGet and doPost methods declared as abstract ?
Date Sun, 11 Jan 2015 08:43:13 GMT
Hi!

My first guess: in that way, you can write a Servlet WITHOUT write ALL the
abstract methods. The concrete methods of HTTPServlet implements the
DEFAULT and EXPECTED behavior.

Angel "Java" Lopez
@ajlopez


On Sun, Jan 11, 2015 at 4:52 AM, <sreyan32@gmail.com> wrote:

> I have been browsing the source code of Tomcat and would like to know why
> the javax.servlet.HTTPServlet class has a non abstract implementation of
> the doGet, doPost, etc methods. Why not just declare them abstract ? I mean
> HTTPServlet is an abstract class so why take the trouble to write
> implementations in HTTPServlet ? Isn’t it better to just mark them as
> abstract methods ?
>
>
> The default methods obviously do nothing until they are overridden,
> wouldn't it be cleaner code if they were abstract ?
>
>
>
>
>
>
> Regards
> Sreyan Chakravarty

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message