- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
是否可以阻止提供的 jar 的 ServletContainerInitializer 的执行。
我想阻止 JerseyServletContainerInitializer.java
的执行它由 Glassfish 4.1 作为 osgi-bundle 提供(在 jersey-container-servlet.jar
中)。
或者我如何使用 <absolute-order>
web.xml 以强制加载 ResteasyServletInitializer.java
在 resteasy-servlet-initializer-3.0.11.Final.jar
中提供在执行 Jersey 对手之前?
我不明白如何使用 web.xml 实现这一点。还有 ServletContainerInitializer
的规范状态:
In either case, 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.
因此,我在我的 glassfish-web.xml 中进行了尝试,但没有任何效果。
请在这方面指导我。
干杯
(附注:从 glassfish/modules/文件夹“works”中删除 jersey-container-servlet.jar
)
最佳答案
Web 片段排序将不起作用,因为 jersey-container-servlet.jar 不是真正的 web 片段。
但以下内容适用于使用 Jersey 2 的 Webogic 12.2。
为您的应用创建类
package my.app;
public class MyJaxRSApplication extends javax.ws.rs.core.Application {}
在 web.xml 中使用此类的完全限定名称注册 Rest Easy servlet
<servlet>
<servlet-name>my.app.MyJaxRSApplication</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
</servlet>
这不会阻止 JerseyServletContainerInitializer 的执行,但不会注册 Jersey servlet。
关于java - 防止执行 ServletContainerInitializer 或如何使用绝对顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31458850/
package sampleJSN; import java.io.IOException; import java.util.Set; import javax.servlet.ServletCon
我正在尝试使用 servletContainerInitializer 注册一个 servlet,但它似乎不起作用,也许这是我的代码(请查看它),但我开始想知道 ServletContainerIni
是否可以阻止提供的 jar 的 ServletContainerInitializer 的执行。 我想阻止 JerseyServletContainerInitializer.java 的执行它由 G
我必须创建一个实现 ServletContextListener 的类在 Tomcat 初始化或关闭期间添加事件。但是,该类必须位于 WEB-INF/lib 内的 jar 文件中。在做了一些阅读之后,
我想将我的 springboot 应用程序(war)部署到 apache tomcat 8,我已经在我的类中扩展了 SpringBootServletInitializer,并在我的 pom.xml
我在 I 类中有我的 servlet 配置,它扩展了 ServletContainerInitializer。我在那里注册 servlet 并定义映射。我不想在我的集成测试中做同样的工作。有没有常见的
我正在尝试将基于 xml 的 Spring MVC 应用程序移动到基于 Java 配置的应用程序。似乎与 maven 中可用的各种 java.servlet 类不匹配。例如,有些提供 addServl
我这样创建 Grizzly WebappContext: WebappContext webContext = new WebappContext("WebappContext", ""); 我有 M
我正在创建一个包含以下依赖项的 OSGi 包 tomcat-dbcp tomcat-embed-core tomcat-embed-jasper tomcat-embed-websocket tomc
在我将 javaee-web-api-7.0.jar 添加到我的 JSF 项目后,它停止工作并出现错误: org.apache.catalina.startup.ContextConfig.proce
我正在编写一些 servlet,它们都运行良好 Tomcat 运行时没有任何问题。然后我编写了一个使用 JERSEY 的类文件,当我尝试运行它时,Tomcat 无法启动。我在 Eclipse 中安装了
我想使用 ServletContainerInitializer 映射 REST API,我的代码是 @Override public void onStartup(Set> classes, Ser
能否在web.xml文件中指向一个实现ServletContainerInitializer接口(interface)的类,还是必须在META-INF/下添加一个文件services/javax.se
尝试通过 gradle 运行 tomcatRun 任务时出现此错误显然这是由于依赖性问题引起的。我的 build.gradle 文件粘贴在下面: apply plugin: 'war' app
我有一个 Web 项目,它有一个 \META-INF\services\javax.servlet.ServletContainerInitializer 文件,其内容指向实现 ServletCont
根据我的理解,3.0 servlet 容器应该扫描类路径以查找 ServletContainerInitializer 接口(interface)的实现(即 springs )。随后这应该调用 Web
我正在尝试用从 Spring 的 WebApplicationInitializer 扩展的基于代码的类替换我的 web.xml 文件。我的 web.xml 文件有几个“env-entry”元素。我试
请让我先告诉你我打算做什么。我打算完全按照 Springframework 网站中提到的“构建 RESTful Web 服务”教程进行操作 http://spring.io/guides/gs/res
我正在使用 Spring 4.3 和 Servlet 3.1。部署失败并出现错误 javax.servlet.ServletContainerInitializer:提供程序 org.springfr
我有七个在 Spring 3.2 中开发的 Web 应用程序,全部基于注释。我使用 Hibernate 4.2 作为我的 ORM 框架。 我创建了一个 tomcat 镜像,其中包含所有 7 个 war
我是一名优秀的程序员,十分优秀!