[英]which servlets are not part of Web application
Servlet specification SRV.3.2 says Servlet规范SRV.3.2说
Servlets in a container that were not deployed as part of aWeb application are implicitly part of a “default” Web application and have a default ServletContext.
未作为Web应用程序的一部分部署的容器中的Servlet隐式属于“默认” Web应用程序的一部分,并且具有默认的ServletContext。
so how can we create serlvets those are not part of web application and what is the use of them? 那么我们如何创建不属于Web应用程序的服务,它们的用途是什么?
Take a look at section SRV.9.1: 看一下SRV.9.1节:
SRV.9.1 Web Applications Within Web Servers
SRV.9.1 Web服务器中的Web应用程序
A web application is rooted at a specific path within a web server.
Web应用程序植根于Web服务器内的特定路径。 For example, a catalog application could be located at http://www.example.com/catalog .
例如,目录应用程序可以位于http://www.example.com/catalog 。 All requests that start with this prefix will be routed to the ServletContext which represents the catalog application.
以该前缀开头的所有请求都将被路由到代表目录应用程序的ServletContext。
Servlets that are not part of a web application are therefore servlets that are not rooted at a specific path. 因此,不属于Web应用程序的Servlet是不以特定路径为根的Servlet。 In other words, they're rooted at the
/
path, and their use is to serve content from there. 换句话说,它们扎根于
/
路径,其用途是从那里提供内容。
Note that this is pretty awkward to begin with (as the verbose text already shows), so most web application servers let you designate an application to run at the 'root' context path in some other way. 请注意,这从开始就很尴尬(如详细的文本已显示),因此大多数Web应用程序服务器都允许您指定应用程序以其他方式在“根”上下文路径中运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.