jsr356-experts@websocket-spec.java.net

[jsr356-experts] Re: [jsr356-users] Re: Path Pot Porri

From: Danny Coward <danny.coward_at_oracle.com>
Date: Wed, 14 Nov 2012 17:57:18 -0800

On 11/14/12 2:26 AM, Mark Thomas wrote:
> On 13/11/2012 22:59, Danny Coward wrote:
>> 3) Remove requirement for leading slash on paths (server-side)
>>
>> e.g. @WebSocketEndpoint("/foo/baa") -> @WebSocketEndpoint("foo/baa")
>> and @WebSocketEndpoint("/") -> @WebSocketEndpoint("")
>>
>> I think we should do this. Removes visual noise for no loss of precision.
> I don't like this. Folks are used to seeing the leading '/'.
Unfortunately it depends which 'folks' :(

JAX-RS does not require the leading slash in its @Path annotation, which
was what I was thinking of when I made the suggestion. However, of
course, the more widely used servlet API and url-pattern syntax for
relative paths (both in the web.xml and @WebServlet, @WebFilter)
requires the leading slash.

So I'm going to change my position and advocate we keep the leading
slash for the relative paths.

Perhaps we'll use paths with no leading slash to mean something else in
a future revision.

> Leaving it
> out creates a possible ambiguity. Are these relative or absolute? If
> relative, relative to what?
>
> This actually raises another thought. What are these paths relative to?
> My expectation is that they are relative to the root of the
> ServletContext but that only makes sense when running in a Servlet
> container. What about when running in some other environment? Are they
> relative to the server root, some environment specific root, something else?
When running the web container, they are relative to the servlet context
root. When running in a 'standalone server' I don't know of a convention
we could use about how to treat the relative paths - it seems that
standalone websocket servers will come to their own conclusions about
what root to relativize the paths to.

We could say that websocket servers must define a root to which all the
relative websocket paths in the same application are relative. If the
websocket server does not include the Servlet API, the websocket server
may choose this itself. But if the websocket server includes the
ServletAPI, that root must be the context root of the web application.

- Danny

> Mark


-- 
<http://www.oracle.com> 	*Danny Coward *
Java EE
Oracle Corporation