incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Sling Website > Request Listeners
Date Fri, 09 Jul 2010 07:47:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=SLINGxSITE&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/SLINGxSITE/Request+Listeners">Request
Listeners</a></h2>
    <h4>Page  <b>added</b> by             <a href="https://cwiki.apache.org/confluence/display/~mykee">Mike
Mueller</a>
    </h4>
         <br/>
    <div class="notificationGreySide">
         <h1><a name="RequestListeners-RequestListenersupport"></a>Request
Listener support</h1>

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

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader"
style="border-bottom-width: 1px;"><b>SlingRequestListener</b></div><div
class="codeContent panelContent">
<pre class="code-java">
<span class="code-keyword">public</span> <span class="code-keyword">interface</span>
SlingRequestListener {
	
	<span class="code-keyword">static</span> <span class="code-keyword">final</span>
<span class="code-object">String</span> SERVICE_NAME = <span class="code-quote">"org.apache.sling.api.request.SlingRequestListener"</span>;


	/**
	 * This method is called from the Sling application <span class="code-keyword">for</span>
every
	 * &lt;code&gt;EventType&lt;/code&gt; appearing during the dispatching of
	 * a Sling request  
	 * 
	 * @param sre the object representing the event
	 * 
	 * @see org.apache.sling.api.request.SlingRequestEvent.EventType
	 */
	<span class="code-keyword">public</span> void onEvent( SlingRequestEvent sre
);
}
</pre>
</div></div>

<p>There are no special properties to set. </p>

<h2><a name="RequestListeners-Supportedtypesofevents"></a>Supported types
of events</h2>

<p>At the moment you will get two different types of <tt>SlingRequestEvent</tt>:</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> events types (<tt>SlingRequestEvent.EventType</tt>)
</th>
<th class='confluenceTh'> point in time </th>
</tr>
<tr>
<td class='confluenceTd'> EVENT_INIT </td>
<td class='confluenceTd'> after entering the <tt>service</tt> method in
<tt>SlingMainServlet</tt>. Note that this will be <b>after</b> the
<tt>handleSecurity</tt> call. </td>
</tr>
<tr>
<td class='confluenceTd'> EVENT_DESTROY </td>
<td class='confluenceTd'> at the end of the <tt>service</tt> method in <tt>SlingMainServlet</tt>
</td>
</tr>
</tbody></table>
</div>

    </div>
    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>
       <a href="https://cwiki.apache.org/confluence/display/SLINGxSITE/Request+Listeners">View
Online</a>
              |
       <a href="https://cwiki.apache.org/confluence/display/SLINGxSITE/Request+Listeners?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
           </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message