OK, so how about this, we say that:-
developers enable/disable endpoint scanning using the web.xml's
metadata-complete= true | false (don't scan, scan)
developers can supply an application config class that lists on demand
those endpoints that he wants deploying (exact API TBD)
the application config class overrides any endpoint scanning, if any.
That way we have a scheme that is:-
- consistent between POJOs and programmatic endpoints
- allows the simple cases to be simple (developers with smaller numbers
of endpoints don't have to do any special configuration at all, just
make sure metadata-complete=false)
- allows the developer to turn off scanning completely (just make sure
metadata-complete=true)
- allows the developer to list out exactly the endpoint to be deployed.
(just supply an application config class)
- Danny
> On 11/28/12 3:34 PM, Mark Thomas wrote:
>>
>> I dislike any approach which mandates some form of scanning. Scanning a
>> WAR is a potentially expensive business and can cause significant (and
>> unacceptable for some users) delay on application start. There needs to
>> be some mechanism (programmatic, static, whatever) that enables a
>> developer to tell the container "deploy this and this exactly and don't
>> do anything else".
>>
>> I think the current solution isn't far off. A
>> ServletContainerInitializer can be annotated with @HandlesTypes for
>> Endpoint and @WebSocketEndpoint. Those that don't want scanning can
>> disable the SCI and use a ServletContextListener and do things
>> programmatically via ContainerProvider.getServerContainer().
>>
>> I have no objection to re-factoring the current solution or even a
>> complete replacement but I do want to see the capabilities retained to:
>> - disable class scanning
>> - explicitly define what is to be deployed with requiring any form of
>> class scanning
>
> +1
>
> The current basic system is fine. The API can be refactored, but we
> already have scanning for those who want it, and those who want the
> programmatic API can use the container initializer. I don't see the
> value of two scanning methods.
>
> -- Scott
>>
>> Mark
>>
>>
>
--
<http://www.oracle.com> *Danny Coward *
Java EE
Oracle Corporation