zoukankan      html  css  js  c++  java
  • Java EE javax.servlet ServletContainerInitializer接口

    ServletContainerInitializer接口

      public interface ServletContainerInitializer

     

      一、介绍

      该接口,允许在 web 应用程序的启动阶段通知Library/Runtime, 并执行对Servlets、Filters和Listeners的任何必需的编程注册。

      此接口的实现必须由位于META-INF/services 目录内的JAR文件资源声明, 并以此接口的完全限定类名命名,and will be discovered using the runtime's service provider lookup mechanism or a container specific mechanism that is semantically equivalent to it. 

      无论哪种情况,ServletContainerInitializer services from web fragment JAR files excluded from an absolute ordering must be ignored, and the order in which these services are discovered must follow the application's classloading delegation model.

     

      二、方法

      1、void onStartup(Set<Class<?>> c,ServletContext ctx) throws ServletException

      将指定的ServletContext所表示的应用程序的启动,告诉这个ServletContainerInitializer。

      如果将此 ServletContainerInitializer 绑定到应用程序的 WEB INF/lib 目录中的 JAR 文件中, 则它的 onStartup 方法将在捆绑应用程序启动期间只调用一次。

      如果此 ServletContainerInitializer 被捆绑在任何 WEB INF/lib 目录之外的 JAR 文件中, 但仍可发现, 如上文所述, 则每次启动应用程序时都会调用其 onStartup 方法。

     

      参数信息:

      c,the Set of application classes that extend, implement, or have been annotated with the class types specified by the HandlesTypes annotation, or null if there are no matches, or this ServletContainerInitializer has not been annotated with HandlesTypes

      ctx,the ServletContext of the web application that is being started and in which the classes contained in c were found

     

     

  • 相关阅读:
    cocos2d-x ios 设置横屏/竖屏(全)
    决策树之ID3算法实现(python)
    基于Spring开发的DUBBO服务接口测试
    Mac电脑下配置maven环境变量
    Mac Eclipse+Maven+TestNg+ReportNg 生成测试报告
    TestNG+Maven+IDEA环境搭建
    115个Java面试题和答案——终极列表(上)
    115个Java面试题和答案——终极列表(下)
    阿里巴巴常考面试题及汇总答案
    阿里面试回来,想和Java程序员谈一谈
  • 原文地址:https://www.cnblogs.com/bigbigbigo/p/8844188.html
Copyright © 2011-2022 走看看