users@websocket-spec.java.net

[jsr356-users] [jsr356-experts] Re: overlapping websocket URI mappings

From: Mark Thomas <mark_at_homeinbox.net>
Date: Tue, 12 May 2015 15:52:16 +0100

On 12/05/2015 14:04, Bill Wigger wrote:
> I want to clarify a point about Websocket Endpoint mappings and the
> Websocket spec.
>
> Case I:
> I have a websocket endpoint that is defined as /mydirectory/myendpoint.html
> and I also have a file defined in my WAR at /mydirectory/myendpoint.html
>
> Case II:
> Wildcards. I have a websocket endpoint defined as
> /mydirectory/{any-string}, and I also have a serlvet mapped to
> /mydirectory/myServlet
>
> Possible outcomes of these two cases:
>
> 1. Not a valid configuration that may result in errors for one or both
> of the mapptings, depending on the websocket implementation.
> or
> 2. the appserver/websocket code should send the request to the websocket
> code if and only if the upgrade header value is "websocket",
> else it will process the URI without going to the websocket code, using
> any applicable URI-without-websocket-upgrade-mapping.
> So, logically, there are two exclusive mappings: "URIs with websocket
> upgrade headers", and "URIs without websocket upgrade headers"
>
> Answer 1 seems like the right answer, in that you normally don't have
> identical URIs map to two different resources.

I disagree. Answer 2 is often used when the client doesn't know how
capable the server (or the proxy between it and the server) is so, for
example, it tries WebSocket and then falls back to HTTP.

Mark

>
> This would be similar to the servlet question posted here:
> https://java.net/jira/browse/SERVLET_SPEC-132?jql=project%20%3D%20SERVLET_SPEC
>
> regards,
> Bill Wigger.
>