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

Java EE javax.servlet ServletContainerInitializer接口的更多相关文章

  1. Java EE javax.servlet中的ServletContext接口

    ServletContext接口 public interface ServletContext (https://docs.oracle.com/javaee/7/api/javax/servlet ...

  2. Java EE javax.servlet.http中的HttpSession接口

    HttpSession接口 public interface HttpSession (https://docs.oracle.com/javaee/7/api/javax/servlet/http/ ...

  3. Java EE javax.servlet中的ServletResponse接口

    ServletResponse接口 public interface ServletResponse 子接口:HttpServletResponse 实现类:HttpServletResponseWr ...

  4. Java EE javax.servlet中的ServletRequest接口

    ServletRequest接口 public interface ServletRequest 子接口:HttpServletRequest 实现类:HttpServletRequestWrappe ...

  5. Java EE javax.servlet中的RequestDispatcher接口

    RequestDispatcher接口 public interface RequestDispatcher 一.介绍 定义一个对象,从客户端接收请求并将其发送到服务器上的任何资源(例如servlet ...

  6. Java EE javax.servlet中的Servlet接口

    Servlet接口 public interface Servlet 其实现类有:FaceServlet.GenericServlet.HttpServlet 一.介绍 Servlet接口定义了所有s ...

  7. Java EE javax.servlet中的ServletConfig接口

    ServletConfig接口 public interface ServletConfig 实现类:GenericServlet.HttpServlet 一.介绍 一个供servlet容器使用配置对 ...

  8. Java EE javax.servlet.http中的HttpRequest抽象类

    HttpRequest抽象类 public abstract class HttpServlet extends GenericServlet 实现的接口有:Serializable, Servlet ...

  9. Caused by: java.lang.ClassCastException: org.springframework.web.SpringServletContainerInitializer cannot be cast to javax.servlet.ServletContainerInitializer错误解决办法

    严重: Failed to initialize end point associated with ProtocolHandler ["http-bio-8080"] java. ...

随机推荐

  1. checkbox为空

    <view:qrytr> <view:qrytd width="15%" heightshow="true">请选择执法范围:</ ...

  2. js类型判断:typeof与instanceof

    typeof用以获取一个变量或者表达式的类型,typeof一般只能返回如下几个结果: number,boolean,string,function(函数),object(NULL,数组,对象),und ...

  3. 使用 Jenkins 发布 web 应用至 Tomcat

    Jenkins 的安装:https://www.cnblogs.com/jhxxb/p/11406805.html 发布流程:Git -> Maven -> Tomcat 一.基本环境 G ...

  4. 性能分析 | JVM发生内存溢出的8种原因及解决办法

    推荐阅读:史上最详细JVM与性能优化知识点综合整理 1.Java 堆空间 2.GC 开销超过限制 3.请求的数组大小超过虚拟机限制 4.Perm gen 空间 5.Metaspace 6.无法新建本机 ...

  5. GIT管理以及运行规范

    继前天看分享的前后端分离后,又重新研究了GIT分支与各个环境的应用. 从开始使用git就一直有在网上查各种资料,查他的运行规范.但不知道是自己理解不够还是怎么的,一直用得不是很好. 根据自己的摸索,整 ...

  6. SQL-W3School-基础:SQL 语法

    ylbtech-SQL-W3School-基础:SQL 语法 1.返回顶部 1. 数据库表 一个数据库通常包含一个或多个表.每个表由一个名字标识(例如“客户”或者“订单”).表包含带有数据的记录(行) ...

  7. Ubuntu16.04.3安装并配置samba方法

    目的:单个Linux用户可以在windows电脑上通过映射网络驱动器的方式来访问自己的工作目录. 方法如下: 1.安装smb服务器:apt-get install samba2.安装smb支持的文件系 ...

  8. Oracle事务、视图、序列

    回顾什么是事务? 一个不可分割的子操作形成一个整体,该整体要么全部执行成功,要么全部执行失败.例如:转帐 回顾为什么要用事务? 如果不用事务的话,为转帐为例,可能出现一个用户钱增加了,另一个用户钱不变 ...

  9. Android之外部存储(SD卡)

    *手机的外部存储空间,这个我们可以理解成电脑的外接移动硬盘,U盘也行.所有的Android设备都有两个文件存储区域:“内部”和“外部”存储器.这两个名称来自早期的Android,当时大多数设备都提供内 ...

  10. chrome调试笔记

    F12启动调试 1.右键加载按钮可以清空缓存并重新加载,有时候浏览器有缓存,代码更新不会及时反映出来. 2.performance mointer实时查看performance 点击三个竖着的小点,选 ...