How can I get real system file path from WebSocket endpoint
1 answer
You can get path information from ServerEndpointConfig # getPath () . The only difference between the results of this method ServletContext#getRealPath()
is that it gives a relational path; you can simply prefix the results of this method with the name of the context root. To get results you need to implement onOpen
(from class javax.websocket.Endpoint
)
//called when the client first negotiates the opening of the websocket connection
public void onOpen(Session session, ServerEndpointConfig config){
String path = config.getPath();
}
0
source to share