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: Tue, 26 Feb 2013 17:56:09 -0800

On 2/26/13 5:41 PM, Mark Thomas wrote:
> On 26/02/2013 13:52, Danny Coward wrote:
>> Hi Mark and Rossen,
>>
>> OK, let me change tack here, and make sure I understand what you are
>> both proposing, and that in fact you agree with each other :)
>>
>> In addition to the existing scan + ServerApplicationConfiguration
>> mechanism, you'd like (* denotes new API)
>>
>> ServerContainer* extends WebSocketContainer {
>> public void deploy(Class<?> pojo) throws DeploymentException;
>> public void deploy(Class<? extends Endpoint> programmaticEndpoint,
>> ServerEndpointConfiguration sec) throws DeploymentException;
>> }
>>
>> So from some some kind of deployment initialization code you would write
>>
>> ServerContainer* sc = ServerContainerProvider*.getServerContainer();
>> sc.deploy(...); ///etc
>>
>> and your placing of such deployment initialization code would be:
>> 1) no webcontainer: not defined
>> 2) web container: using some existing servlet mechanism, e.g. inside a
>> ServletContextListener configured in the web.xml.
>>
>> Is that right ?
>
> Yes.
>
> The one slight change is that with the new config APIs the second
> method becomes:
> public void deploy(ServerEndpointConfiguration sec)
> throws DeploymentException;
>
>> If so, we are currently trying to restrict there to be one
>> ServerContainer instance per websocket application. Do you have enough
>> context under the ServerContainerProvider*.getServerContainer(); call to
>> do that ?
>
> Yes. Currently I use the current context classloader (which is the web
> application class loader in a servlet container) to ID the right
> ServerContainer / determine I need to create a new one.
OK thanks Mark. Then I think this works too.

Everyone, if you have a strong opinion about either extending the
ServerApplicationConfiguration scheme as I laid out yesterday, or about
this pure programmatic proposal above to have explicit deployment
methods on the *Container then please add you opinion asap. Also please
speak up if you see any technical issues with either approach.

I think both approaches would be work, the differences seem to be mostly
in the actual design approach. Right now I'm outnumbered !

- Danny

>
> Mark
>


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