zoukankan      html  css  js  c++  java
  • servlet上下文接口(JDK)

    定义servlet用于与其servlet容器进行通信的一组方法,例如获取文件的MIME类型,调度请求或写入日志文件。
    每个Java虚拟机每个“Web应用程序”都有一个上下文。 (“Web应用程序”是安装在服务器的URL命名空间的特定子集下的servlet和内容的集合,如/ catalog,可能通过.war文件安装。)
    在其部署描述符中标记为“分布式”的Web应用程序的情况下,每个虚拟机将有一个上下文实例。 在这种情况下,上下文不能用作共享全局信息的位置(因为信息不是真正的全局信息)。 使用像数据库这样的外部资源。
    ServletContext对象包含在ServletConfig对象中,Web服务器在servlet初始化时提供servlet。

    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.

  • 相关阅读:
    JDBC面试问题
    Linux下如何实现MySQL数据库每天自动备份定时备份
    Linux下如何实现MySQL数据库每天自动备份定时备份
    Linux下如何实现MySQL数据库每天自动备份定时备份
    Random Forest And Extra Trees
    经济学十大原理
    JavaScript的执行机制
    单元测试
    JavaScript是如何工作的(一)
    阿里大数据竞赛season1 总结
  • 原文地址:https://www.cnblogs.com/zhaoby451/p/7251157.html
Copyright © 2011-2022 走看看