javax.servlet
Interface ServletContext
-
public interface ServletContext
Defines a set of methods that a servlet uses to communicate with its servlet container, for example, to get the MIME type of a file, dispatch requests, or write to a log file.
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.)
In the case of a web application marked "distributed" in its deployment descriptor, there will be one context instance for each virtual machine. In this situation, the context cannot be used as a location to share global information (because the information won't be truly global). Use an external resource like a database instead.
The ServletContext object is contained within the ServletConfig object, which the Web server provides the servlet when the servlet is initialized.
本文详细介绍了ServletContext接口的功能与用途。此接口定义了一组方法,用于使servlet能够与其容器进行通信,例如获取文件的MIME类型、分发请求或写入日志文件。每个Java虚拟机中的web应用都有一个对应的上下文实例。
1575

被折叠的 条评论
为什么被折叠?



