Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [servlet-dev] Big ticket items for Servlet 6 / Jakarta EE 10?



On Fri, 28 Aug 2020 at 12:37, arjan tijms <arjan.tijms@xxxxxxxxx> wrote:
To support this in Servlet containers such as Tomcat and Jetty would need some instance management API of some kind. With that I mean an API where Servlet containers never instantiate or store Servlets themselves, but always request these from some API. The implementation of this API can then delegate to say Weld, or to the existing code Servlet containers are using. I suppose it can be done, but might be more invasive to Servlet itself.

This is more or less how it is done today anyway, just without a standard API.   We have a Decorator API with the methods:
 
    <T> T decorate(T o);
    void destroy(Object o);
 
We call this on all Listeners, Filters and Servlets that the container instantiates.  We use this mechanism for CDI integrations (both custom and a generic SPI one) and also for javax.annotation handling of injection and lifecycle callback.   It was interesting that last year we updated our CDI integrations: Weld wanted to continue calling a Decorate style API, but OpenWebBeans preferred to invert the integration so that Jetty calls the CDI SPI.  

Having a standard decoration mechanism would allow specs like CDI to include their own integration that used the standard decorator to invoke the existing SPI.  Something like Jetty's Decorator would work or perhaps something like

     <T> T create(Class<T> c);
    void destroy(Object o);









--

Back to the top