Servlet Application Architecture




The basic architecture of an application that involves processing of servlets, and thus, implies the existence of the servlet container, which communicates with the clients requests by the HTTP protocol. The servlet container it will be replaced by a JSP container in the context of JSP page files usage. Their role is the same.
There are two configurations for the architecture of a servlet application. The first one shows the general case, when the servlet container gets the requests from client and distributes them both to servlets and to static content.




Fig 11. The server application architecture
As a servlet application includes also static content, like simple HTML pages and image files, the speed of the serving the static content of such pages by the servlet container is lower than if using a HTTP server, that can manages all the connections in a more robust way. An example of such server is Tomcat Apache Server. Placing a web server in front of the client requests improves the response time for answering the requests. In this way, a separation is being made between static content pages and servlets, which are requested and implied in action by the servelt container. The following architecture is the most common one met in the servlet applications.