Lets review what happens when a servlet gets a request. 1. Before your service method gets called, the servlet container constructs a request object and a response object. The request object is populated with the HTTP headers parsed out of the request. We are talking lots of String operations here, with all header lines parsed and placed in a Map.This is time consuming.
2. Your service method (the one inherited from DefaultServlet) looks at the method - GET or POST or whatever and calls your custom doPost or doGet with those request and response objects.
How much time do you think this one string comparison takes compared to all that parsing?
We're pleased to have you here with us in the Servlets forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.