atmosphere icon indicating copy to clipboard operation
atmosphere copied to clipboard

[JSR 356] Multiple endpoints on one servlet but only the first endpoint works

Open buharov-alexander opened this issue 5 years ago • 0 comments

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.

buharov-alexander avatar Aug 03 '18 11:08 buharov-alexander