Understanding servlet container

纵饮孤独 提交于 2019-11-27 11:17:08

问题


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.


回答1:


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.




回答2:


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.




回答3:


Here's a good basic explanation of Servlet Containers - http://inheritingjava.blogspot.com/2011/02/chapter-2-web-servers-and-servlet.html




回答4:


WebLogic, JBOSS, and other Java EE app servers have servlet containers, plus more: EJBs, naming and directory service, JMS, etc.

Servlets are HTTP listeners that run inside a servlet container. The servlet can be mapped to response to HTTP GET and POST requests to a given URL of your choice. The container manages the lifecycle and pooling of the servlets.




回答5:


The Java EE architecture is a component oriented system with an articulated container, component model, and a managed life-cycle and mediated inter-component communication.

The Java EE web-container defines the components of this tier (e.g. {Servlet, Filter}), and the contractual interface between the components and the web-container (e.g. ServletContext).

(If coming from .NET, this is effectively the [same conceptual paradigm as the] Component, Container and ISite is the Java EE XML declarative mappings.) [edit]



来源:https://stackoverflow.com/questions/6719004/understanding-servlet-container

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!