Our team had a discussion yesterday why Spawning might be a good solution for our Python-Django specific Web server. The discussion is still hot on the table and have not come to a conclusion; nonetheless, Spawning does look really promising if we are to extract every ounce of power from a server and utilize its full power. We were questioning if using Apache is like using a “sledgehammer to swat flies”.
Earlier, we’ve introduced you to Java Servlets — what they are, life cycle, advantages. Let’s move ahead with Java Servlets and get some simple code to handle the HTTP GET Request to show you how to write a servlet.
Servlets can be used for handling both the GET Requests and the POST Requests. However in this post, let’s write the code for handling the GET Request. The HttpServlet class is used for handling HTTP GET Requests as it has some specialized methods that can efficiently handle the HTTP requests. These methods are;
An individual developing servlets for handling HTTP Requests needs to override one of these methods in order to process the request and generate a response. The servlet is invoked dynamically when an end-user submits a form.