【发布时间】:2013-12-06 07:49:48
【问题描述】:
我正在尝试开发一个使用 websocket 端点的 Java EE 7 Web 应用程序并将其部署在 Jetty 服务器上。
应用程序具有以下结构:
Game/
src/
main/
java/
game/
WebSocketEndpoint.java
webapp/
index.html
scripts/
variousjavascriptstuff.js
WEB-INF/
beans.xml
web.xml
在 beans.xml 文件中:
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
bean-discovery-mode="annotated">
WebSocketEndpoint 已正确注释并且可以与 Netbeans/Glassfish4 一起正常工作,但是,应用程序必须部署在 Jetty 服务器上。
所以,我的问题 - 如何将 websocket 端点映射到 web.xml 文件中的 URL /game?我找到了许多映射 servlet 的示例,但我认为这不适用于服务器端点。
或者,有没有办法为Jetty写一个web.xml文件,让它自动发现ll注解的类/方法(类似于上面的beans.xml)
【问题讨论】:
标签: java jakarta-ee web-applications jetty java-ee-7