0

I seen this topic: How can I get real system file path from within a WebSocket Endpoint

With the same problem. I tried to use:

@OnOpen
public void onOpen(Session session, ServerEndpointConfig config){
    contextPath = config.getPath();
}

But when I try to deploy wildly raise this error:

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]

I would like to get this path into onMessage method to generate an image dynamically.

Thanks for your help,

Regards

Community
  • 1
  • 1
bioinfornatics
  • 1,749
  • 3
  • 17
  • 36

1 Answers1

0

I found a way to do it:

@OnOpen
public void onOpen(Session session, EndpointConfig config){
    session.getUserProperties().put("contextPath", ((ServerEndpointConfig)config).getPath())
}
bioinfornatics
  • 1,749
  • 3
  • 17
  • 36