jsr356-experts@websocket-spec.java.net

[jsr356-experts] Re: [jsr356-users] Re: More more programmatic deployment

From: Danny Coward <danny.coward_at_oracle.com>
Date: Thu, 28 Feb 2013 15:52:48 -0800

>>> Hmm. I wrote a long reply to this that got me thinking. This is an
>>> arifact of how I opted to implement WebSocket in Tomcat. I *think* I
>>> can do without this method but I have some fairly major refactoring to
>>> do to determine if that is the case. The refactoring is also something
>>> I'm going to have to do if I want to support registration of endpoints
>>> at times other than servlet context start (as a container specific
>>> feature).
>
> That isn't going to work. There is a fundamental problem that if a
> purely programmatic approach is used then something has to tell the
> web socket ServerContainer what the ServletContext is. I don't see a
> way around this.
We're looking right now at some web container specific way of doing this
in our implementation. We have something working, but its not as elegant
as it might be :)

- Danny




> I think the setRoot() method (or soemthing equivalent) is going to be
> required.
>
>> OK. The other question I had was we're trying to figure out if there is
>> a clean point in our websocket implementation to know that the
>> application deployment phase is complete.
>>
>> i.e. if we want to restrict the use of deploy() to only the application
>> deployment phase (specifically, only to calls from
>> ServletContextListeners) how can the websocket implementation know that
>> all the possible ServletContextListeners have been called ? Are
>> websocket implementations going to have to rely on something proprietary
>> in the web container to tell them that ?
>
> This is relatively simple in Tomcat's implementation because each
> registration adds a servlet mapping to the web socket servlet via the
> Servlet API. If I try to do that once the servlet context has started
> it will fail.
>
>> Or could it be more easily marked by noting the first occurrence of the
>> web container passing on the first opening handshake to an endpoint in
>> the application ?
>
> Yeah, that could be tricky for other implementations.
>
> Mark


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