ServletContext是每个Web应用程序一个还是每个JVM一个? [英] Is ServletContext one per web-app or one per JVM?
问题描述
我怀疑ServletContext是每个web-app一个,每个JVM一个。但是,如果我在同一个JVM上运行多个Web应用程序。然后每个JVM有2个ServletContext。可能吗?任何人都可以详细说明这个吗?
Here is the doubt I have come up with ServletContext is one per web-app and one per JVM. But if I am running more than one web-app on the same JVM. Then it has 2 ServletContext per JVM. Is it Possible? Can anybody elaborate on this?
推荐答案
每个webapp都有自己的ServletContext。 api docs <的方式/ a>把它放在:
Each webapp will have its own ServletContext. The way the api docs put it is:
每个Java虚拟机每个web应用程序有一个上下文。 (Web应用程序是安装在服务器URL命名空间的特定子集下的servlet和内容的集合,例如/ catalog,可能通过.war文件安装。)
There is one context per "web application" per Java Virtual Machine. (A "web application" is a collection of servlets and content installed under a specific subset of the server's URL namespace such as /catalog and possibly installed via a .war file.)
每个Web应用程序部分意味着如果您在群集中设置应用程序,则群集中的每个节点都有一个单独的JVM,并且该JVM将运行所有的单独副本应用程序,包括每个webapp的ServletContext。
The "per web application" part means that if you set up the application in a cluster then each node in the cluster has a separate JVM, and that JVM will be running separate copies of all the applications, including a ServletContext for each webapp.
这篇关于ServletContext是每个Web应用程序一个还是每个JVM一个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!