How does a Container work?

6

How does container work for web application servers, such as Tomcat?

    
asked by anonymous 09.10.2015 / 19:54

2 answers

4

What is a container

In this case, we call container what will support our application to run.

That is, our application does not have enough code to run on its own, it needs someone to load it into memory, receive requests and direct these requests to it.

These containers are usually application servers .

Even when the container is an application server, it can also act in some scenarios in an "on-board" mode instead of acting as a service, for example.

And what is an application server

  

An application server such as Tomcat (and we can cite other examples like GlasFish , WebSphere , JBoss IIS , etc), is a specialized system to support applications consumed remotely.

They are often associated with "web applications" , although these applications are often only accessed through a private network.

These application servers alone do nothing important. Their function is to make a specific application available that addresses specific needs.

How does an application server support a web application?

Strictly speaking, you do not need an application server to run your web application.

See: You can write code that listens for TCP / IP requests on a specific server port, interprets these requests under the HTTP protocol, message HTTP, and return a response in another HTTP message.

You may also want to add code to handle logging, load balancing, caching, database connection pooling, security, encryption ... Once you've implemented all this you'll have made your own application server to meet one application in particular.

And that's what application servers are all about: delivering standard solutions that will be required by many different web applications.

An example

Consider a web application that is Java and implements Servlets .

The basic function of the application server, in this case, is to load this application into memory, receive remote requests, and direct each request to the Servlet responsible for serving it according to application settings that the application server reads and respects. / p>

When your Servlet provides a response, the application server returns this response on the same port in response to that request.

    
09.10.2015 / 22:37
3

Brother, the issue is the specification to run your application. for example, if you follow the JEE - standard edition, it has 2 types of servers that support various types of technologies in this case (your question) WebContainer and EJB Container. As I use WebContainer, I will talk about it. In the case of TomCat, it is a simple webcontainer or a webcontainer to manage web applications, developed in JSF, JSP servlets (specifications that are contained in the JEE). The form of operation would be exemplified by a comparison: Imagine a browser requesting static pages (HTML) to a server, which in turn will return a response, in this case the page in question. With webcontainer managing the application it will dynamically format the response and return exclusive content to the client. in relation to its tag, it is not completely correct, since an application server is more complete, it is not just a webcontainer or just an EJB container, it is both in addition to several other things. Example application servers: GlasFish and JBoss.

    
09.10.2015 / 22:32