If the idea is that the websocket code fails the request somehow, then the
appserver tries another non-websocket endpoint that may be sharing all or
part of the /mydirectory/* mapping, then that seems like it should be
defined somewhere, most likely in the servlet spec, since it is the
appserver/servlet code that is receiving the failure and then trying to
find a new mapping. But I don't see that anywhere in the Servlet spec.
What is the appropriate way for the websocket code to signal the appserver,
"this request wasn't really for me, but I'm not rejecting it back to the
user" ?
If we add another protocol to the equation, which also has mapped endpoints
to /mydirectory/*, then how does the appserver handle that? How does it
decide who gets first shot at the request?
So, I guess my main question comes down to, between the WebSocket and
Servlet spec, how does one deal with multiple mappings of one URI to
mulitple endpoints? It seems this information is missing from the specs,
so then what would be the appropriate algorithm/APIs for handling this
situation, and which spec should include it? One of my concerns is that
different implementations are going to make up their own rules here.
regards,
Bill
From: Mark Thomas <mark_at_homeinbox.net>
To: jsr356-experts_at_websocket-spec.java.net
Date: 05/12/2015 10:52 AM
Subject: [jsr356-experts] Re: overlapping websocket URI mappings
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.
>