Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding servlet container

As a UI devloper and someone with very limited Java knowledge, how do I understand what exactly is servlet container in simple terms ?

I have heard Weblogic, JBoss, etc are servlet containers, but not sure what that means exactly. Does it mean any middleware technology ?

Could you please help me.

like image 852
copenndthagen Avatar asked Jul 16 '11 17:07

copenndthagen


People also ask

How does a servlet container work?

In the beginning, the container instantiates a servlet by calling its init() method. Once its initialization is complete, the servlet is ready to accept incoming requests. Subsequently, the container directs these requests for processing in the servlet's service() method.

What is difference between servlet and servlet container?

The servlet container provides the runtime environment for the servlet. The Agent handles the details of network programming, receives and parses requests, transmits responses, and manages connections. The servlet container instantiates the servlets and maintains state.

What is called servlet container?

The servlet container is the part of web server which can be run in a separate process. We can classify the servlet container states in three types: Standalone: It is typical Java-based servers in which the servlet container and the web servers are the integral part of a single program.


2 Answers

A servlet is a class that you will use to receive HTTP requests as methods and reply back with stuff (usually HTML).

A servlet container is a server program which provides everything else; the opening of the socket, the transformation framework to turn HTTP into Java API calls, and a number of interfaces which allow you to plug in your servlet code.

If it were an electrical outlet, the servlet container would be the socket in the wall, and the servlet would be the plug and cord that attaches to the socket; but, Java used a 'container' analogy. The servlet container is the "bucket" you put your servlet stuff into.

like image 134
Edwin Buck Avatar answered Sep 22 '22 21:09

Edwin Buck


A servlet container is an application server that implements some version of the Java Servlet Specification.

In a nutshell, the servlet spec defines a programming model that allows a developer to write components, for example servlets, that process requests (almost always HTTP requests). Those components can then be declared to the container and it handles many of the tedious tasks involved with wiring up and managing those components such that they can process those requests.

like image 41
brabster Avatar answered Sep 21 '22 21:09

brabster