我试图在JBoss应用程序中添加REST氛围。目的是保持Web应用程序运行并添加Web服务。 (通过Ant部署的应用程序)AtmosphereMappingException:在JBoss应用程序中集成
我已加入下列罐子:
- 气氛-runtime.jar
- JAXRS-API-1.1-RC2.jar
- JBoss的接缝-RestEasy的-2.2 .0.GA.jar
- RestEasy的-JAXRS-1.1-RC2.jar
web.xml中:
<servlet>
<description>AtmosphereServlet</description>
<servlet-name>AtmosphereServlet</servlet-name>
<servlet-class>org.atmosphere.cpr.AtmosphereServlet</servlet-class>
<load-on-startup>0</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>AtmosphereServlet</servlet-name>
<url-pattern>/atmosphere/*</url-pattern>
</servlet-mapping>
atmosphere.xml:
<atmosphere-handlers>
<!-- RESTEasy -->
<atmosphere-handler support-session="false"
context-root="/*/atmosphere"
class-name="org.atmosphere.handler.ReflectorServletProcessor"
interceptorClasses="org.atmosphere.interceptor.IdleResourceInterceptor">
<property name="servletClassName"
value="org.jboss.seam.servlet.SeamResourceServlet"/>
</atmosphere-handler>
</atmosphere-handlers>
我的Java类是这样的:
@Path("/test")
public class Foo {
@Context HttpServletRequest req;
@GET
@Path("/suspend")
public Response suspend() {
/*
AtmosphereResource r = (AtmosphereResource)
req.getAttribute("org.atmosphere.cpr.AtmosphereResource");
r.resumeOnBroadcast(true);
r.setBroadcaster(BroadcasterFactory.getDefault().lookup("/test", true))
.suspend();
*/
return Response.ok().build();
}
}
网址:http://XXX.XXX.XX.XXX:8080/posmngr/atmosphere/test
每次我试图进入我得到以下错误的网址:
ERROR [[AtmosphereServlet]] Servlet.service() for servlet AtmosphereServlet threw exception
org.atmosphere.cpr.AtmosphereMappingException: No AtmosphereHandler maps request for /posmngr/atmosphere/test/
我将根上下文更改为“/ atmosphere/*”,但是我得到了一个404. 我错过了什么吗?任何帮助将非常感激。提前致谢!
您使用的是哪个版本的Atmosphere?尝试atmosphere-runtime-2.0.0.jar谢谢 - Jeanfrancois – jfarcand 2014-09-04 20:46:50
我正在与大气层2.1.7 – 2014-09-05 17:31:20