5.2. Using a Servlet for the Standings Class
In order to make our Standings class function as a servlet, there are just a few things we need to add to it. The first decision to make is what to base the new servlet on. We could extend our BasicStandingsImpl class, creating a new ServletStandingsImpl class that added the necessary servlet methods. Because Java doesn't support multiple inheritance, if we decide to subclass BasicStandingsImpl then we cannot also subclass one of the servlet classes (GenericServlet or HttpServlet), which means we would instead have to implement the Servlet interface. While this approach would be perfectly valid, we would rather leverage the service() method provided in the HttpServlet class that already takes care ...
Get J2EE™ and JAX™: Developing Web Applications and Web Services now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.