我看到了这个主题:How can I get real system file path from within a WebSocket Endpoint
有同样的问题。我尝试使用:
@OnOpen
public void onOpen(Session session, ServerEndpointConfig config){
contextPath = config.getPath();
}
但是当我尝试疯狂部署时会引发此错误:
17:59:33,634 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 101) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./: java.lang.RuntimeException: javax.websocket.DeploymentException: UT003012: Method public void fr.foo.server.BarEndPoint.onOpen(javax.websocket.Session,javax.websocket.server.ServerEndpointConfig) has invalid parameters at locations [1]
我想将此路径导入 onMessage 方法以动态生成图像。
谢谢你的帮助,
问候