Hi Felix,
> The implementation on the Sling or OSGi side, though, is currently > missing. One thing is, that such a thing is not part of the OSGi > HttpService specification (which is based on the Servlet API 2.1). The > other missing thing is support by Sling itself. > Yes I know, Although, I have had a look at PAX Web HTTP Service Extensions [1] and it seems to solve this issue. Anyway, I don´t know how can I make this thing work with Servlets deployed to Sling... > For plain Sling applications, I would think, that SlingServletContext > and SlingMainServlet would be extended to support such a > ServletContextAttributeListener functionality. > > For example: > > * SlingMainServlet would act as a proxy providing the attributeAdded, > attributeRemoved and attributeReplaced methods > * SlingMainServlet would dispatch the method calls to registered > services. > * SlingServletContext would call the respective methods of the > SlingMainServlet to dispatch the events > > WDYT ? Does this sound reasonable ? > Yep, this sounds good. However, I´m not sure if this is a must have for the Sling core development. Now, I´m working in a Bayeux (comet) [2] server layer over Sling. My first attempt has been re-use the cometd-jetty project [3] and to develope a Servlet extending SuspendingCometdServlet. If you see the cometd-jetty demo [4], the bayeux object is initialized and set as a context attribute. Thanks to a ServletContextAttributeListener [5], the bayeux services are initialized. Therefore, i wondered about servlet listener support in Sling. Maybe you can help me with my use case in other way. Thanks in advance, BR, Juanjo. [1] http://wiki.ops4j.org/confluence/display/ops4j/Pax+Web+-+Http+Service+Extensions [2] http://cometdproject.dojotoolkit.org/ [3] http://repo1.maven.org/maven2/org/mortbay/jetty/cometd-jetty/ [4] http://svn.codehaus.org/jetty-contrib/branches/jetty-6.1.x/contrib/cometd/demo/ [5] http://svn.codehaus.org/jetty-contrib/branches/jetty-6.1.x/contrib/cometd/demo/src/main/java/org/cometd/demo/BayeuxServicesListener.java
