简体   繁体   English

哪些servlet不属于Web应用程序

[英]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.

相关问题 servlet是编写Java Web应用程序的唯一方法 - Are servlets the only way to write a Java Web Application 独立于Servlet的Web应用程序设计(不使用Web服务器使用应用程序服务器) - Web application design that is independent of servlets (uses Web server no application server ) Spring Boot应用程序启动应用程序初始化web.xml中的servlet - Spring Boot application to start application initializing servlets in web.xml 如何在一个Spring应用程序中的web.xml中注册多个servlet - How to register multiple servlets in web.xml in one Spring application jsp / servlet中的Web应用程序-使用fmt:message进行本地化 - Web application in jsp/servlets - localization using fmt:message Web应用程序中的url-pattern WSATCoordinator映射到多个Servlet - The url-pattern WSATCoordinator in web application is mapped to multiple Servlets Android使用现有Web应用程序中的Java Servlet - Android using java servlets from an existing web application 基于Web的应用程序中的更新方法-Java Servlets - Updating Method in Web-Based application - Java Servlets 反映servlets类文件中的Web应用程序更改 - reflect on web-application changes in servlets class file 如何从属于 web 应用程序插件的 servlet 中访问 .js 文件? - How to access .js file from within a servlet which is part of a web application plugin?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM