atmosphere
atmosphere copied to clipboard
[JSR 356] Multiple endpoints on one servlet but only the first endpoint works
I use atmosphere 2.4.28 and tomcat 9.0.5 My servlet config:
<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
...
<init-param>
<param-name>org.atmosphere.cpr.asyncSupport</param-name>
<param-value>org.atmosphere.container.JSR356AsyncSupport</param-value>
</init-param>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
Also, I have multiple server endpoints associated with this servlet:
/v1
, /v2
, ...
I can establish the WebSocket connection with all endpoints but if I make a request - only one endpoint(v3
) will work as expected. Other endpoints return 404
error.
Seems JSR356AsyncSupport
creates endpoints for paths:
/api
/api/{path0}
/api/{path0}/{path1}
/api/{path0}/{path1}/{path2}
...
Then WsServerContainer
from tomcat-websocket
addes only one TemplatePathMatch
for each endpoint and ignores others. So requests only to one endpoint (which was init first) can be resolved correctly.