users@websocket-spec.java.net

[jsr356-users] Re: ServerApplicationConfiguration

From: Arun Gupta <arun.p.gupta_at_oracle.com>
Date: Wed, 09 Jan 2013 11:04:51 -0800

Danny,

> On 1/8/13 2:12 PM, Arun Gupta wrote:
>> How do you expect a typical implementation of
>> Set<Class>
>> ServerApplicationConfiguration.getAnnotatedEndpointClasses(Set<Class>) to
>> look like ?
>
>
> Something like:-
>
> public Set<Class>
> ServerApplicationConfiguration.getAnnotatedEndpointClasses(Set<Class>
> scannedOnes) {
> Set onesIWantToDeploy = new HashSet();
> for (Class next : scannedOnes) {
> if (doIReallyWantThisOneAfterAll(next)) {
> onesIWantToDeploy.add(next);
> }
> }
> return onesIWantToDeploy;
> }
>
>
I assume this would be read once at deployment time and so the list of
WebSocket endpoints will be defined at that time ? What kind of
information is available in doIReallyWantThisOneAfterAll(next) to make a
decision ?

What would be some typical criteria ?
>
>>
>> Seems like the parameter will already contain the list of classes
>> annotated with @WebSocketEndpoint ?
>
> Yes, they are the result of the scan for annotated endpoints.
>>
>> Is the expectation that interface-driven endpoints will be added to
>> this set and returned back ?
> No, they are scanned for separately, and passed into
> getEndpointConfigurationClasses(), or more precisely, their endpoint
> configurations are scanned for and passed into that method.
For an interface-driven endpoint, at least two classes are required ?

- Endpoint class
- ServerEndpointConfiguration

And possibly a third ?

- ServerApplicationConfiguration
>>
>> What if I do not include @WebSocketEndpoint in the list ? Are those
>> endpoints then not deployed by the server ?
> Correct, the ones you return out of these methods are deployed, which
> may not be all of them.
>
>>
>> Is there a mechanism to provide configuration across all the
>> endpoints - annotation or interface-driven ?
>
> What kind of configuration ? If you want some kind of global thing
> they all hook up to, then you can subclass/implement your own
> *Configuration class with a getGlobalThing() method on it if you like,
> except for the annotated client case (see last email).
If I want to hook up a set of encoder/decoder(s) to all the WebSocket
endpoints (annotated and interface-driven), is that not possible today ?

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

-- 
http://twitter.com/arungupta
http://blogs.oracle.com/arungupta