Servlet listeners support in Sling
----------------------------------

                 Key: SLING-682
                 URL: https://issues.apache.org/jira/browse/SLING-682
             Project: Sling
          Issue Type: Improvement
          Components: Engine
            Reporter: Juan Jose Vazquez Delgado
            Assignee: Juan Jose Vazquez Delgado
            Priority: Minor


As discussed in http://markmail.org/message/cdhzd6ol7x3qg65m, it might be 
useful to have some kind of Servlet listener support in Sling. 

First of all, we will cover the Sling Web App Launchpad case.  Following 
Felix´s suggestions, the algorithm would be more or less:

1. Make a ServletListenerProxy implementing all Servlet API listener services.
2. This class is registered in the launchpad web app using the <listener> 
element as defined in the Servlet API Spec.
3. Upon context creation of the Sling Web App, the proxy places itself into the 
context as a context attribute.
4. When the SlingServlet is initialized it looks at the ServletContext for the 
ServletListenerProxy instance. It hands over the BundleContext
of the system bundle, which is actually the result of calling 
getBundleContext() on the Felix instance (since the Felix class launching the 
framework is the system bundle). Using this BundleContext, the proxy would use 
ServiceTrackers for all Servlet API Listener services.
5. When a Servlet API event arrives, the proxy checks the respective 
ServiceTracker for services and forwards the event to the services.
6. When Sling is shutdown in the SlingServlet.destroy method, the proxy is also 
terminated and closes the ServiceTrackers.
7. Finally the proxy removes itself from the servlet context.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to