Bug 57676

Summary: WebSocket check same path endpoint implementation enhancement
Product: Tomcat 8 Reporter: yangkun <yklovejava>
Component: WebSocketAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P2    
Version: 8.0.5   
Target Milestone: ----   
Hardware: PC   
OS: All   

Description yangkun 2015-03-09 02:10:30 UTC
If there are two websocket endpoint has same path, eg, path is "/",Tomcat start will report the following errors:

Multiple Endpoints may not be deployed to the same path [/]
...

  But the errors info can't provide us more enough info.We can't know which the two endpoints.If so,we may need to search texts,I think not very convenient.
  If report the following errors info, we can know which two endpoints:

Multiple Endpoints may not be deployed to the same path [/], the first endpoint is [echo.EchoServer], the second endpoint is [echo.annoted.EchoServer]

  
  The simple way is to modify WsServerContainer#addEndpoint() method and org/apache/tomcat/websocket/server/LocalStrings.properties.

  example:

#serverContainer.duplicatePaths=Multiple Endpoints may not be deployed to the same path [{0}]
serverContainer.duplicatePaths=Multiple Endpoints may not be deployed to the same path [{0}], the first endpoint is [{1}], the second endpoint is [{2}]


if (old != null) {
// Duplicate path mappings
	throw new DeploymentException(sm.getString("serverContainer.duplicatePaths", path, old.getEndpointClass().getName(), sec.getEndpointClass().getName()));
}
Comment 1 Christopher Schultz 2015-03-09 16:31:00 UTC
Fixed in trunk in r1665292 and Tomcat 8.0.x in r1665296.
Will be in Tomcat 8.0.21.
Comment 2 Christopher Schultz 2015-03-09 16:36:54 UTC
Note that I do not intend to back-port this to Tomcat 7 unless someone requests it.
Comment 3 Violeta Georgieva 2015-06-01 12:07:25 UTC
Fixed in Tomcat 7 trunk and will be in 7.0.63 onwards.