You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by bu...@apache.org on 2013/09/25 07:03:53 UTC

svn commit: r879811 - in /websites/staging/deltaspike/trunk/content: ./ documentation.html servlet.html

Author: buildbot
Date: Wed Sep 25 05:03:53 2013
New Revision: 879811

Log:
Staging update by buildbot for deltaspike

Added:
    websites/staging/deltaspike/trunk/content/servlet.html
Modified:
    websites/staging/deltaspike/trunk/content/   (props changed)
    websites/staging/deltaspike/trunk/content/documentation.html

Propchange: websites/staging/deltaspike/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Wed Sep 25 05:03:53 2013
@@ -1 +1 @@
-1525510
+1526108

Modified: websites/staging/deltaspike/trunk/content/documentation.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/documentation.html (original)
+++ websites/staging/deltaspike/trunk/content/documentation.html Wed Sep 25 05:03:53 2013
@@ -90,6 +90,7 @@
 <li><a href="#jpa-module">JPA Module</a></li>
 <li><a href="#jsf-module">JSF Module</a></li>
 <li><a href="#bean-validation-module">Bean Validation Module</a></li>
+<li><a href="#servlet-module">Servlet Module</a></li>
 </ul>
 </li>
 <li><a href="#with-java-se">With Java SE</a><ul>
@@ -117,6 +118,7 @@
 <li><a href="#jsf-optional">JSF (optional)</a></li>
 <li><a href="#container-control-optional">Container Control (optional)</a></li>
 <li><a href="#bean-validation-optional">Bean Validation (optional)</a></li>
+<li><a href="#servlet-optional">Servlet (optional)</a></li>
 </ul>
 </li>
 <li><a href="#external">External</a><ul>
@@ -241,6 +243,23 @@ In the listings below replace the placeh
 </pre></div>
 
 
+<h4 id="servlet-module">Servlet Module</h4>
+<div class="codehilite"><pre><span class="nt">&lt;dependency&gt;</span>
+    <span class="nt">&lt;groupId&gt;</span>org.apache.deltaspike.modules<span class="nt">&lt;/groupId&gt;</span>
+    <span class="nt">&lt;artifactId&gt;</span>deltaspike-servlet-module-api<span class="nt">&lt;/artifactId&gt;</span>
+    <span class="nt">&lt;version&gt;</span><span class="cp">${</span><span class="n">deltaspike</span><span class="o">.</span><span class="n">version</span><span class="cp">}</span><span class="nt">&lt;/version&gt;</span>
+    <span class="nt">&lt;scope&gt;</span>compile<span class="nt">&lt;/scope&gt;</span>
+<span class="nt">&lt;/dependency&gt;</span>
+
+<span class="nt">&lt;dependency&gt;</span>
+    <span class="nt">&lt;groupId&gt;</span>org.apache.deltaspike.modules<span class="nt">&lt;/groupId&gt;</span>
+    <span class="nt">&lt;artifactId&gt;</span>deltaspike-servlet-module-impl<span class="nt">&lt;/artifactId&gt;</span>
+    <span class="nt">&lt;version&gt;</span><span class="cp">${</span><span class="n">deltaspike</span><span class="o">.</span><span class="n">version</span><span class="cp">}</span><span class="nt">&lt;/version&gt;</span>
+    <span class="nt">&lt;scope&gt;</span>runtime<span class="nt">&lt;/scope&gt;</span>
+<span class="nt">&lt;/dependency&gt;</span>
+</pre></div>
+
+
 <h3 id="with-java-se">With Java SE</h3>
 <p>To use DeltaSpike with Java SE, we must provide additional jars file corresponding to the DeltaSpike CDI Controller API
 and its implementation. The Controller uses Java Services to resolve the CDI container (<a href="http://docs.jboss.org/weld/reference/1.1.5.Final/en-US/html/">JBoss Weld</a>, <a href="http://openwebbeans.apache.org">Apache OpenWebbeans</a> (and <a href="http://openejb.apache.org">Apache OpenEJB</a>)) and
@@ -411,6 +430,14 @@ The resolved bean is a normal CDI bean w
 <p>Features : Allows a developer to create CDI aware <code>ConstraintValidator</code>s that can use business objects (EJBs, ManagedBeans) to support validation needs.</p>
 <p>*
 <a class="btn" href="bean-validation.html">View details »</a></p>
+<h2 id="servlet-optional">Servlet (optional)</h2>
+<p>Definition : The DeltaSpike Servlet module provides integration with the Java Servlet API.</p>
+<p>Features : </p>
+<ul>
+<li>Injection of common servlet objects.</li>
+<li>Propagation of servlet events to the CDI event bus. </li>
+</ul>
+<p><a class="btn" href="servlet.html">View details »</a></p>
 <h1 id="external">External</h1>
 <h2 id="blogs">Blogs</h2>
 <ul>

Added: websites/staging/deltaspike/trunk/content/servlet.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/servlet.html (added)
+++ websites/staging/deltaspike/trunk/content/servlet.html Wed Sep 25 05:03:53 2013
@@ -0,0 +1,334 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta name="description" content="deltaspike-generate-pages">
+    <meta name="author" content="chm">
+
+    <title>Apache DeltaSpike - Servlet module</title>
+
+    
+
+    
+    <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in compliance with the License.  You may obtain a copy of the License at . http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the specific language governing permissions and limitations under the License. -->
+
+    <!-- Styles -->
+    
+    <link href="./resources/css/bootstrap.css" rel="stylesheet">    
+    <!--<link href="./resources/css/prettify.css" rel="stylesheet" /> -->
+    <link href="./resources/css/codehilite.css" rel="stylesheet" />
+    <link href="./resources/css/bootstrap-responsive.css" rel="stylesheet">
+    <style type="text/css">
+        body {
+            padding-top: 60px;
+            padding-bottom: 40px;
+        }
+    </style>
+	<script type="text/javascript">
+
+	  var _gaq = _gaq || [];
+	  _gaq.push(['_setAccount', 'UA-36103647-1']);
+	  _gaq.push(['_trackPageview']);
+	
+	  (function() {
+		var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+		ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+		var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+	  })();
+	
+	</script>
+</head>
+
+<body>
+
+    <div class="navbar navbar-fixed-top">
+        <div class="navbar-inner">
+            <div class="container">
+                <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
+                    <span class="icon-bar"></span>
+                    <span class="icon-bar"></span>
+                    <span class="icon-bar"></span>
+                </a>
+                <a class="brand" href="index.html"><img src="./resources/images/deltaspike-logo-medium.png"/></a>
+                <div class="nav-collapse">
+                    <ul class="nav">
+                        <li class="active"><a href="./index.html">Home</a></li>
+                        <li><a href="./documentation.html">Documentation</a></li>
+                        <li><a href="./source.html">Source</a></li>
+                        <!-- <li><a href="./download.html">Download</a></li> -->
+                        <li><a href="./community.html">Community</a></li>
+                        <!-- <li><a href="./support.html">Support</a></li>  -->
+                        <li><a href="./news.html">News</a></li>
+                        <li><a href="./migration-guide.html">Migration</a></li>
+                    </ul>
+                </div><!--/.nav-collapse -->
+                <form id="search-form" action="http://www.google.com/search" method="get"  class="navbar-search pull-right" >
+                    <input value="deltaspike.apache.org" name="sitesearch" type="hidden"/>
+                    <input class="search-query" name="q" id="query" type="text" />
+                </form>
+            </div>
+        </div>
+    </div>
+
+    <div class="container">
+      <div class="row">
+          <div class="span12">
+              <div class="page-title">
+                <h1>Servlet module</h1>
+              </div>
+              <div class="toc">
+<ul>
+<li><a href="#configuration">Configuration</a></li>
+<li><a href="#injectable-servlet-objects">Injectable Servlet objects</a><ul>
+<li><a href="#servletcontext">ServletContext</a></li>
+<li><a href="#servletrequest-httpservletrequest">ServletRequest / HttpServletRequest</a></li>
+<li><a href="#servletresponse-httpservletresponse">ServletResponse / HttpServletResponse</a></li>
+<li><a href="#httpsession">HttpSession</a></li>
+<li><a href="#principal">Principal</a></li>
+</ul>
+</li>
+<li><a href="#servlet-event-propagation">Servlet event propagation</a><ul>
+<li><a href="#servlet-context-lifecycle-events">Servlet context lifecycle events</a></li>
+<li><a href="#request-and-response-lifecycle-events">Request and response lifecycle events</a></li>
+<li><a href="#session-lifecycle-events">Session lifecycle events</a></li>
+</ul>
+</li>
+</ul>
+</div>
+<hr />
+<h1 id="configuration">Configuration</h1>
+<p>In most cases there is no need for any additional configuration beside adding the required 
+dependencies to your project, because all required listeners and filters are automatically 
+registered in the container.</p>
+<p>However there are certain situations in which you will have to manually register the 
+listeners and filters in your <code>web.xml</code>:</p>
+<ul>
+<li>Your container doesn't support Servlet 3.0 or newer.</li>
+<li>You have set <code>metadata-complete=true</code> in your <code>web.xml</code>.</li>
+<li>You packaged the servlet module in the <code>lib</code> directory of an EAR archive.</li>
+</ul>
+<p>In these cases you will have to add the following section manually to your <code>web.xml</code>:</p>
+<div class="codehilite"><pre><span class="nt">&lt;listener&gt;</span>
+    <span class="nt">&lt;display-name&gt;</span>EventBridgeContextListener<span class="nt">&lt;/display-name&gt;</span>
+    <span class="nt">&lt;listener-class&gt;</span>org.apache.deltaspike.servlet.impl.event.EventBridgeContextListener<span class="nt">&lt;/listener-class&gt;</span>
+<span class="nt">&lt;/listener&gt;</span>
+
+<span class="nt">&lt;listener&gt;</span>
+    <span class="nt">&lt;display-name&gt;</span>EventBridgeSessionListener<span class="nt">&lt;/display-name&gt;</span>
+    <span class="nt">&lt;listener-class&gt;</span>org.apache.deltaspike.servlet.impl.event.EventBridgeSessionListener<span class="nt">&lt;/listener-class&gt;</span>
+<span class="nt">&lt;/listener&gt;</span>
+
+<span class="nt">&lt;listener&gt;</span>
+    <span class="nt">&lt;display-name&gt;</span>ServletContextHolderListener<span class="nt">&lt;/display-name&gt;</span>
+    <span class="nt">&lt;listener-class&gt;</span>org.apache.deltaspike.servlet.impl.produce.ServletContextHolderListener<span class="nt">&lt;/listener-class&gt;</span>
+<span class="nt">&lt;/listener&gt;</span>
+
+<span class="nt">&lt;filter&gt;</span>
+    <span class="nt">&lt;display-name&gt;</span>RequestResponseHolderFilter<span class="nt">&lt;/display-name&gt;</span>
+    <span class="nt">&lt;filter-name&gt;</span>RequestResponseHolderFilter<span class="nt">&lt;/filter-name&gt;</span>
+    <span class="nt">&lt;filter-class&gt;</span>org.apache.deltaspike.servlet.impl.produce.RequestResponseHolderFilter<span class="nt">&lt;/filter-class&gt;</span>
+<span class="nt">&lt;/filter&gt;</span>
+<span class="nt">&lt;filter-mapping&gt;</span>
+    <span class="nt">&lt;filter-name&gt;</span>RequestResponseHolderFilter<span class="nt">&lt;/filter-name&gt;</span>
+    <span class="nt">&lt;url-pattern&gt;</span>/*<span class="nt">&lt;/url-pattern&gt;</span>
+<span class="nt">&lt;/filter-mapping&gt;</span>
+
+<span class="nt">&lt;filter&gt;</span>
+    <span class="nt">&lt;display-name&gt;</span>EventBridgeFilter<span class="nt">&lt;/display-name&gt;</span>
+    <span class="nt">&lt;filter-name&gt;</span>EventBridgeFilter<span class="nt">&lt;/filter-name&gt;</span>
+    <span class="nt">&lt;filter-class&gt;</span>org.apache.deltaspike.servlet.impl.event.EventBridgeFilter<span class="nt">&lt;/filter-class&gt;</span>
+<span class="nt">&lt;/filter&gt;</span>
+<span class="nt">&lt;filter-mapping&gt;</span>
+    <span class="nt">&lt;filter-name&gt;</span>EventBridgeFilter<span class="nt">&lt;/filter-name&gt;</span>
+    <span class="nt">&lt;url-pattern&gt;</span>/*<span class="nt">&lt;/url-pattern&gt;</span>
+<span class="nt">&lt;/filter-mapping&gt;</span>
+</pre></div>
+
+
+<h1 id="injectable-servlet-objects">Injectable Servlet objects</h1>
+<p>The DeltaSpike Servlet module contains producers for many objects of a Servlet environment. 
+All produces are using the special qualifier <code>@Web</code> for compatibility with CDI 1.1, 
+which supports the injection of some Servlet objects out of the box.</p>
+<p>The following code shows the general injection pattern to use for all objects.</p>
+<div class="codehilite"><pre><span class="p">@</span><span class="n">Inject</span> <span class="p">@</span><span class="n">Web</span>
+<span class="n">private</span> <span class="n">ServletObject</span> <span class="n">servletObject</span><span class="p">;</span>
+</pre></div>
+
+
+<h2 id="servletcontext">ServletContext</h2>
+<p>The <code>ServletContext</code> is made available in the application scope. It can be injected into any CDI bean 
+like this:</p>
+<div class="codehilite"><pre><span class="p">@</span><span class="n">Inject</span> <span class="p">@</span><span class="n">Web</span>
+<span class="n">private</span> <span class="n">ServletContext</span> <span class="n">servletContext</span><span class="p">;</span>
+</pre></div>
+
+
+<h2 id="servletrequest-httpservletrequest">ServletRequest / HttpServletRequest</h2>
+<p>The <code>ServletRequest</code> is made available in the request scope. The current request can be injected 
+into a CDI bean like this:</p>
+<div class="codehilite"><pre><span class="p">@</span><span class="n">Inject</span> <span class="p">@</span><span class="n">Web</span>
+<span class="n">private</span> <span class="n">ServletRequest</span> <span class="n">request</span><span class="p">;</span>
+</pre></div>
+
+
+<p>In case of HTTP requests you can also inject the <code>HttpServletRequest</code>:</p>
+<div class="codehilite"><pre><span class="p">@</span><span class="n">Inject</span> <span class="p">@</span><span class="n">Web</span>
+<span class="n">private</span> <span class="n">HttpServletRequest</span> <span class="n">request</span><span class="p">;</span>
+</pre></div>
+
+
+<h2 id="servletresponse-httpservletresponse">ServletResponse / HttpServletResponse</h2>
+<p>The <code>ServletResponse</code> is made available in the request scope. The current response can be 
+injected into a CDI bean like this:</p>
+<div class="codehilite"><pre><span class="p">@</span><span class="n">Inject</span> <span class="p">@</span><span class="n">Web</span>
+<span class="n">private</span> <span class="n">ServletResponse</span> <span class="n">response</span><span class="p">;</span>
+</pre></div>
+
+
+<p>In case of HTTP requests you can also inject the <code>HttpServletResponse</code>:</p>
+<div class="codehilite"><pre><span class="p">@</span><span class="n">Inject</span> <span class="p">@</span><span class="n">Web</span>
+<span class="n">private</span> <span class="n">HttpServletResponse</span> <span class="n">response</span><span class="p">;</span>
+</pre></div>
+
+
+<h2 id="httpsession">HttpSession</h2>
+<p>The <code>HttpSession</code> is made available in the session scope. You can inject the current session 
+of a user into a CDI bean like this:</p>
+<div class="codehilite"><pre><span class="p">@</span><span class="n">Inject</span> <span class="p">@</span><span class="n">Web</span>
+<span class="n">private</span> <span class="n">HttpSession</span> <span class="n">session</span><span class="p">;</span>
+</pre></div>
+
+
+<p>Please note that injecting the session this way will force the creation of a session. </p>
+<h2 id="principal">Principal</h2>
+<p>The <code>Principal</code> is made available in the request scope. The current principal can be 
+injected into a CDI bean like this:</p>
+<div class="codehilite"><pre><span class="p">@</span><span class="n">Inject</span> <span class="p">@</span><span class="n">Web</span>
+<span class="n">private</span> <span class="n">Principal</span> <span class="n">principal</span><span class="p">;</span>
+</pre></div>
+
+
+<p>The <code>Principal</code> is obtained by calling <code>getUserPrincipal()</code> on the <code>HttpServletRequest</code>.</p>
+<h1 id="servlet-event-propagation">Servlet event propagation</h1>
+<p>The DeltaSpike Servlet module will propagate a number of Servlet object lifecycle events to 
+the CDI event bus. This allows regular CDI beans to observe these events and react accordingly.</p>
+<p>In most cases the event type is the object whose lifecycle is observed. To distinguish 
+between construction and destruction of the corresponding object, DeltaSpike uses the 
+qualifiers <code>@Initialized</code> and <code>@Destroyed</code>.</p>
+<p>The following sections will show which concrete Servlet objects are supported and how their 
+lifecycle can be observed.</p>
+<h2 id="servlet-context-lifecycle-events">Servlet context lifecycle events</h2>
+<p>The Servlet module supports initialization and destruction events for the <code>ServletContext</code>. These events
+can for example be used to detect application startup or shutdown. The following code shows
+how these events can be observed:</p>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">void</span> <span class="n">onCreate</span><span class="p">(@</span><span class="n">Observes</span> <span class="p">@</span><span class="n">Initialized</span> <span class="n">ServletContext</span> <span class="n">context</span><span class="p">)</span> <span class="p">{</span>
+    <span class="n">System</span><span class="p">.</span><span class="n">out</span><span class="p">.</span><span class="n">println</span><span class="p">(</span>&quot;<span class="n">Initialized</span> <span class="n">ServletContext</span><span class="p">:</span> &quot; <span class="o">+</span> <span class="n">context</span><span class="p">.</span><span class="n">getServletContextName</span><span class="p">());</span>
+<span class="p">}</span>
+
+<span class="n">public</span> <span class="n">void</span> <span class="n">onDestroy</span><span class="p">(@</span><span class="n">Observes</span> <span class="p">@</span><span class="n">Destroyed</span> <span class="n">ServletContext</span> <span class="n">context</span><span class="p">)</span> <span class="p">{</span>
+    <span class="n">System</span><span class="p">.</span><span class="n">out</span><span class="p">.</span><span class="n">println</span><span class="p">(</span>&quot;<span class="n">Destroyed</span> <span class="n">ServletContext</span><span class="p">:</span> &quot; <span class="o">+</span> <span class="n">context</span><span class="p">.</span><span class="n">getServletContextName</span><span class="p">());</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p>The events are emitted from a <code>ServletContextListener</code> called <code>EventBridgeContextListener</code>. You can
+disable lifecycle events for the <code>ServletContext</code> by deactivating the following class:</p>
+<div class="codehilite"><pre><span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">deltaspike</span><span class="p">.</span><span class="n">servlet</span><span class="p">.</span><span class="n">impl</span><span class="p">.</span><span class="n">event</span><span class="p">.</span><span class="n">EventBridgeContextListener</span>
+</pre></div>
+
+
+<p>If you manually registered the required filters and listeners, you can also simply remove the
+entry for the <code>EventBridgeContextListener</code> from your <code>web.xml</code> to disable the events.</p>
+<h2 id="request-and-response-lifecycle-events">Request and response lifecycle events</h2>
+<p>The Servlet module also supports initialization and destruction events for the <code>HttpServletRequest</code>
+and <code>HttpServletResponse</code>. These events can for example be used for initialization work like invoking
+<code>setCharacterEncoding</code> on the request.</p>
+<p>The following example shows how to observe lifecycle events for the request:</p>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">void</span> <span class="n">onCreate</span><span class="p">(@</span><span class="n">Observes</span> <span class="p">@</span><span class="n">Initialized</span> <span class="n">HttpServletRequest</span> <span class="n">request</span><span class="p">)</span> <span class="p">{</span>
+    <span class="n">System</span><span class="p">.</span><span class="n">out</span><span class="p">.</span><span class="n">println</span><span class="p">(</span>&quot;<span class="n">Starting</span> <span class="n">to</span> <span class="n">process</span> <span class="n">request</span> <span class="k">for</span><span class="p">:</span> &quot; <span class="o">+</span> <span class="n">request</span><span class="p">.</span><span class="n">getRequestURI</span><span class="p">());</span>
+<span class="p">}</span>
+
+<span class="n">public</span> <span class="n">void</span> <span class="n">onDestroy</span><span class="p">(@</span><span class="n">Observes</span> <span class="p">@</span><span class="n">Destroyed</span> <span class="n">HttpServletRequest</span> <span class="n">request</span><span class="p">)</span> <span class="p">{</span>
+    <span class="n">System</span><span class="p">.</span><span class="n">out</span><span class="p">.</span><span class="n">println</span><span class="p">(</span>&quot;<span class="n">Finished</span> <span class="n">processing</span> <span class="n">request</span> <span class="k">for</span><span class="p">:</span> &quot; <span class="o">+</span> <span class="n">request</span><span class="p">.</span><span class="n">getRequestURI</span><span class="p">());</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p>Observing lifecycle events for the response works the same way:</p>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">void</span> <span class="n">onCreate</span><span class="p">(@</span><span class="n">Observes</span> <span class="p">@</span><span class="n">Initialized</span> <span class="n">HttpServletResponse</span> <span class="n">response</span><span class="p">)</span> <span class="p">{</span>
+    <span class="n">System</span><span class="p">.</span><span class="n">out</span><span class="p">.</span><span class="n">println</span><span class="p">(</span>&quot;<span class="n">HttpServletResponse</span> <span class="n">created</span>&quot;<span class="p">);</span>
+<span class="p">}</span>
+
+<span class="n">public</span> <span class="n">void</span> <span class="n">onDestroy</span><span class="p">(@</span><span class="n">Observes</span> <span class="p">@</span><span class="n">Destroyed</span> <span class="n">HttpServletResponse</span> <span class="n">response</span><span class="p">)</span> <span class="p">{</span>
+    <span class="n">System</span><span class="p">.</span><span class="n">out</span><span class="p">.</span><span class="n">println</span><span class="p">(</span>&quot;<span class="n">HttpServletResponse</span> <span class="n">destroyed</span>&quot;<span class="p">);</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p>All events of this category are emitted from a servlet filter called <code>EventBridgeFilter</code>.
+If you want to disable events for this category, just use DeltaSpike's deactivation mechanism
+to deactivate the following class:</p>
+<div class="codehilite"><pre><span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">deltaspike</span><span class="p">.</span><span class="n">servlet</span><span class="p">.</span><span class="n">impl</span><span class="p">.</span><span class="n">event</span><span class="p">.</span><span class="n">EventBridgeFilter</span>
+</pre></div>
+
+
+<p>If you manually registered the required filters and listeners you can also simply remove the
+entry for the <code>EventBridgeFilter</code> from your <code>web.xml</code> to disable the events.</p>
+<h2 id="session-lifecycle-events">Session lifecycle events</h2>
+<p>The last category of events supported by the DeltaSpike Servlet module are the lifecycle events
+for the user's HTTP session. The following example shows how these events can be observed from
+a regular CDI bean.</p>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">void</span> <span class="n">onCreate</span><span class="p">(@</span><span class="n">Observes</span> <span class="p">@</span><span class="n">Initialized</span> <span class="n">HttpSession</span> <span class="n">session</span><span class="p">)</span> <span class="p">{</span>
+    <span class="n">System</span><span class="p">.</span><span class="n">out</span><span class="p">.</span><span class="n">println</span><span class="p">(</span>&quot;<span class="n">Session</span> <span class="n">created</span><span class="p">:</span> &quot; <span class="o">+</span> <span class="n">session</span><span class="p">.</span><span class="n">getId</span><span class="p">());</span>
+<span class="p">}</span>
+
+<span class="n">public</span> <span class="n">void</span> <span class="n">onDestroy</span><span class="p">(@</span><span class="n">Observes</span> <span class="p">@</span><span class="n">Destroyed</span> <span class="n">HttpSession</span> <span class="n">session</span><span class="p">)</span> <span class="p">{</span>
+    <span class="n">System</span><span class="p">.</span><span class="n">out</span><span class="p">.</span><span class="n">println</span><span class="p">(</span>&quot;<span class="n">Session</span> <span class="n">destroyed</span><span class="p">:</span> &quot; <span class="o">+</span> <span class="n">session</span><span class="p">.</span><span class="n">getId</span><span class="p">());</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p>The lifecycle events for the HTTP session are sent from a <code>HttpSessionListener</code> called
+<code>EventBridgeSessionListener</code>. To disable this event category, deactivate the following
+class:</p>
+<div class="codehilite"><pre><span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">deltaspike</span><span class="p">.</span><span class="n">servlet</span><span class="p">.</span><span class="n">impl</span><span class="p">.</span><span class="n">event</span><span class="p">.</span><span class="n">EventBridgeSessionListener</span>
+</pre></div>
+
+
+<p>If you manually registered the required filters and listeners you can also simply remove the
+entry for the <code>EventBridgeSessionListener</code> from your <code>web.xml</code> to disable the events.</p>
+          </div>
+      </div>
+
+      <hr>
+
+      <footer>
+        <p>Copyright © 20011-2012 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.</p>
+        <p>Apache and the Apache feather logo are trademarks of The Apache Software Foundation.</p>
+      </footer>
+
+    </div> <!-- /container -->
+
+    <!-- Javascript
+    ================================================== -->
+    <!-- Placed at the end of the document so the pages load faster -->
+    <!--<script src="./resources/js/prettyfy.js"></script> -->
+    <script src="./resources/js/prettyprint.js"></script>
+    <script src="./resources/js/jquery.js"></script>
+    <script src="./resources/js/bootstrap-transition.js"></script>
+    <script src="./resources/js/bootstrap-alert.js"></script>
+    <script src="./resources/js/bootstrap-modal.js"></script>
+    <script src="./resources/js/bootstrap-dropdown.js"></script>
+    <script src="./resources/js/bootstrap-scrollspy.js"></script>
+    <script src="./resources/js/bootstrap-tab.js"></script>
+    <script src="./resources/js/bootstrap-tooltip.js"></script>
+    <script src="./resources/js/bootstrap-popover.js"></script>
+    <script src="./resources/js/bootstrap-button.js"></script>
+    <script src="./resources/js/bootstrap-collapse.js"></script>
+    <script src="./resources/js/bootstrap-carousel.js"></script>
+    <script src="./resources/js/bootstrap-typeahead.js"></script>
+
+</body>
+</html>