I guess the answer to this question is similar to the answer regarding HttpServletResponse and -Request interfaces on top of page 107 HF S&J. The Container vendor has already extended/implemented all servlet abstract classes and interfaces and when we use instances of these classes in our code, we are really using objects of these "vendor"-classes behind the scene.
Ok, in the response and request interfaces i understand, there are objects that was implemented by container and im using the reference to this objects.
But , in HttpServlet abstract class , i inherited direct from this class .. so i need to implement many abstract methods .
Or the container changes my code to put another class that implemts HttpServlet ? if its true ... so i understand , because "MyServlet" is inherited a class that implements the Abstract class HttpServlet .
but .. i know that this code above run without problem , i just want to understand how ou who implements the abstract methods from HttpServlets ?
If HttpServlet is an Abstract class ...so there are many abstract methods in this class right ? so when i inherited one class from HttpServlet i dont implements these methods ... who implements ? do the container changes in my code to refer to another class taht implements HttpServlet ?
i know that it run .. i want to understand how ...
HttpServlet class doesn't contain any abstract methods.so u don't have to implement all the methods in that class when u derive from HttpServlet. If u still have problem in unserstanding, please refer http://java.sun.com/docs/books/tutorial/java/javaOO/abstract.html
Even though HttpServlet is an abstract class, it does not have any abstract methods. Hence, you need not implement any. But the docs say that you must override atleast one method. The container implementation of these methods like doPost, doGet etc will be to show some kind of an error. If you do not override, say doGet() and issue an url for this servlet, you might get something like HTTP method GET is not supported by this URL (on Tomcat 5.0)