This is an old version of the Sling website, see the site conversion page for more info.
Apache
Apache Sling Website > Apache Sling > Documentation > The Sling Engine > Request Listeners

Request Listener support

Sling provides the possibility to "listen" to a request processed by the Sling Engine (SlingMainServlet). To get notified you implement the service interface org.apache.sling.api.request.SlingRequestListener.

SlingRequestListener
public interface SlingRequestListener {
	
	static final String SERVICE_NAME = "org.apache.sling.api.request.SlingRequestListener";	

	/**
	 * This method is called from the Sling application for every
	 * <code>EventType</code> appearing during the dispatching of
	 * a Sling request  
	 * 
	 * @param sre the object representing the event
	 * 
	 * @see org.apache.sling.api.request.SlingRequestEvent.EventType
	 */
	public void onEvent( SlingRequestEvent sre );
}

There are no special properties to set.

Supported types of events

At the moment you will get two different types of SlingRequestEvent:

events types (SlingRequestEvent.EventType) point in time
EVENT_INIT after entering the service method in SlingMainServlet. Note that this will be after the handleSecurity call.
EVENT_DESTROY at the end of the service method in SlingMainServlet
Last modified by mykee on 2010-07-09 03:46:21.0
Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.