deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r921871 [7/7] - in /websites/staging/deltaspike/trunk/content: ./ documentation/
Date Thu, 11 Sep 2014 14:16:50 GMT
Added: websites/staging/deltaspike/trunk/content/documentation/servlet.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/documentation/servlet.html (added)
+++ websites/staging/deltaspike/trunk/content/documentation/servlet.html Thu Sep 11 14:16:50 2014
@@ -0,0 +1,535 @@
+<!DOCTYPE html>
+<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>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="http://deltaspike.apache.org/resources/css/bootstrap.css" rel="stylesheet">
+<link href="http://deltaspike.apache.org/resources/css/bootstrap-responsive.css" rel="stylesheet">
+
+<style type="text/css">
+/* Foundation stylesheet for CodeRay (to match GitHub theme) | MIT License | http://foundation.zurb.com */
+table.CodeRay { border-collapse: collapse; padding: 2px; margin-bottom: 0; border: 0; background: transparent; }
+table.CodeRay td { padding: 0 .5em; vertical-align: top; }
+table.CodeRay td.line-numbers { text-align: right; color: #999; border-right: 1px solid #e5e5e5; padding-left: 0; }
+span.line-numbers { border-right: 1px solid #E5E5E5; color: #999; display: inline-block; margin-right: 0.5em; padding-right: 0.5em; }
+.CodeRay td.line-numbers strong, .CodeRay span.line-numbers strong { font-weight: normal; }
+.CodeRay .debug { color: white !important; background: blue !important; }
+.CodeRay .annotation { color: #007; }
+.CodeRay .attribute-name { color: #f08; }
+.CodeRay .attribute-value { color: #700; }
+.CodeRay .binary { color: #509; }
+.CodeRay .comment  { color: #999; font-style: italic; }
+.CodeRay .char { color: #04D; }
+.CodeRay .char .content { color: #04D; }
+.CodeRay .char .delimiter { color: #039; }
+.CodeRay .class { color: #458; }
+.CodeRay .complex { color: #A08; }
+.CodeRay .constant { color: teal; }
+.CodeRay .color { color: #0A0; }
+.CodeRay .class-variable { color: #369; }
+.CodeRay .decorator { color: #B0B; }
+.CodeRay .definition { color: #099; }
+.CodeRay .directive { color: #088; }
+.CodeRay .delimiter { color: black; }
+.CodeRay .doc { color: #970; }
+.CodeRay .doctype { color: #34b; }
+.CodeRay .doc-string { color: #D42; }
+.CodeRay .escape  { color: #666; }
+.CodeRay .entity { color: #800; }
+.CodeRay .error { color: #808; }
+.CodeRay .exception { color: #C00; }
+.CodeRay .filename { color: #099; }
+.CodeRay .function { color: #900; }
+.CodeRay .global-variable { color: teal; }
+.CodeRay .hex { color: #058; }
+.CodeRay .integer  { color: #099; }
+.CodeRay .include { color: #B44; }
+.CodeRay .inline { color: black; }
+.CodeRay .inline .inline { background: #ccc; }
+.CodeRay .inline .inline .inline { background: #bbb; }
+.CodeRay .inline .inline-delimiter { color: #D14; }
+.CodeRay .inline-delimiter { color: #D14; }
+.CodeRay .important { color: #f00; }
+.CodeRay .interpreted { color: #B2B; }
+.CodeRay .instance-variable { color: teal; }
+.CodeRay .label { color: #970; }
+.CodeRay .local-variable { color: #963; }
+.CodeRay .octal { color: #40E; }
+.CodeRay .predefined { color: #369; }
+.CodeRay .preprocessor { color: #579; }
+.CodeRay .pseudo-class { color: #00C; }
+.CodeRay .predefined-type { color: #074; }
+.CodeRay .reserved, .keyword  { color: #000; }
+.CodeRay .key { color: #808; }
+.CodeRay .key .delimiter { color: #606; }
+.CodeRay .key .char { color: #80f; }
+.CodeRay .value { color: #088; }
+.CodeRay .regexp { background-color: #fff0ff; }
+.CodeRay .regexp .content { color: #808; }
+.CodeRay .regexp .delimiter { color: #404; }
+.CodeRay .regexp .modifier { color: #C2C; }
+.CodeRay .regexp .function  { color: #404; font-weight: bold; }
+.CodeRay .string { color: #D20; }
+.CodeRay .string .string { }
+.CodeRay .string .string .string { background-color: #ffd0d0; }
+.CodeRay .string .content { color: #D14; }
+.CodeRay .string .char { color: #D14; }
+.CodeRay .string .delimiter { color: #D14; }
+.CodeRay .shell { color: #D14; }
+.CodeRay .shell .content { }
+.CodeRay .shell .delimiter { color: #D14; }
+.CodeRay .symbol { color: #990073; }
+.CodeRay .symbol .content { color: #A60; }
+.CodeRay .symbol .delimiter { color: #630; }
+.CodeRay .tag, .CodeRay .attribute-name { color: #070; }
+.CodeRay .tag-special { color: #D70; }
+.CodeRay .type { color: #339; }
+.CodeRay .variable  { color: #036; }
+.CodeRay .insert { background: #afa; }
+.CodeRay .delete { background: #faa; }
+.CodeRay .change { color: #aaf; background: #007; }
+.CodeRay .head { color: #f8f; background: #505; }
+.CodeRay .insert .insert { color: #080; }
+.CodeRay .delete .delete { color: #800; }
+.CodeRay .change .change { color: #66f; }
+.CodeRay .head .head { color: #f4f; }
+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 logocolor"
+					href="http://deltaspike.apache.org/index.html">Apache
+					DeltaSpike</a>
+				<div class="nav-collapse">
+					<ul class="nav">
+						<li class="active"><a
+							href="http://deltaspike.apache.org/index.html">Home</a></li>
+						<li><a href="http://deltaspike.apache.org/documentation">Documentation</a></li>
+						<li><a href="http://deltaspike.apache.org/source.html">Source</a></li>
+						<li><a href="http://deltaspike.apache.org/download.html">Download</a></li>
+						<li><a href="http://deltaspike.apache.org/community.html">Community</a></li>
+						<!-- <li><a href="./support.html">Support</a></li>  -->
+						<li><a href="http://deltaspike.apache.org/news.html">News</a></li>
+						<li><a
+							href="http://deltaspike.apache.org/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 id="toc" class="toc2">
+       	 		<ul class="sectlevel1">
+<li><a href="#_configuration">Configuration</a></li>
+<li><a href="#_injectable_servlet_objects">Injectable Servlet objects</a></li>
+<li>
+<ul class="sectlevel2">
+<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></li>
+<li>
+<ul class="sectlevel2">
+<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>
+       	 		<hr>	
+       	 		
+				<div class="sect1">
+<h2 id="_configuration">Configuration</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<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>
+</div>
+<div class="paragraph">
+<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>
+</div>
+<div class="ulist">
+<ul>
+<li>
+<p>Your container doesn&#8217;t support Servlet 3.0 or newer.</p>
+</li>
+<li>
+<p>You have set <code>metadata-complete=true</code> in your <code>web.xml</code>.</p>
+</li>
+<li>
+<p>You packaged the servlet module in the <code>lib</code> directory of an EAR archive.</p>
+</li>
+</ul>
+</div>
+<div class="paragraph">
+<p>In these cases you will have to add the following section manually to
+your <code>web.xml</code>:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="xml language-xml"><span class="tag">&lt;listener&gt;</span>
+    <span class="tag">&lt;display-name&gt;</span>EventBridgeContextListener<span class="tag">&lt;/display-name&gt;</span>
+    <span class="tag">&lt;listener-class&gt;</span>org.apache.deltaspike.servlet.impl.event.EventBridgeContextListener<span class="tag">&lt;/listener-class&gt;</span>
+<span class="tag">&lt;/listener&gt;</span>
+
+<span class="tag">&lt;listener&gt;</span>
+    <span class="tag">&lt;display-name&gt;</span>EventBridgeSessionListener<span class="tag">&lt;/display-name&gt;</span>
+    <span class="tag">&lt;listener-class&gt;</span>org.apache.deltaspike.servlet.impl.event.EventBridgeSessionListener<span class="tag">&lt;/listener-class&gt;</span>
+<span class="tag">&lt;/listener&gt;</span>
+
+<span class="tag">&lt;listener&gt;</span>
+    <span class="tag">&lt;display-name&gt;</span>ServletContextHolderListener<span class="tag">&lt;/display-name&gt;</span>
+    <span class="tag">&lt;listener-class&gt;</span>org.apache.deltaspike.servlet.impl.produce.ServletContextHolderListener<span class="tag">&lt;/listener-class&gt;</span>
+<span class="tag">&lt;/listener&gt;</span>
+
+<span class="tag">&lt;listener&gt;</span>
+    <span class="tag">&lt;display-name&gt;</span>RequestResponseHolderListener<span class="tag">&lt;/display-name&gt;</span>
+    <span class="tag">&lt;listener-class&gt;</span>org.apache.deltaspike.servlet.impl.produce.RequestResponseHolderListener<span class="tag">&lt;/listener-class&gt;</span>
+<span class="tag">&lt;/listener&gt;</span>
+
+<span class="tag">&lt;filter&gt;</span>
+    <span class="tag">&lt;display-name&gt;</span>RequestResponseHolderFilter<span class="tag">&lt;/display-name&gt;</span>
+    <span class="tag">&lt;filter-name&gt;</span>RequestResponseHolderFilter<span class="tag">&lt;/filter-name&gt;</span>
+    <span class="tag">&lt;filter-class&gt;</span>org.apache.deltaspike.servlet.impl.produce.RequestResponseHolderFilter<span class="tag">&lt;/filter-class&gt;</span>
+<span class="tag">&lt;/filter&gt;</span>
+<span class="tag">&lt;filter-mapping&gt;</span>
+    <span class="tag">&lt;filter-name&gt;</span>RequestResponseHolderFilter<span class="tag">&lt;/filter-name&gt;</span>
+    <span class="tag">&lt;url-pattern&gt;</span>/*<span class="tag">&lt;/url-pattern&gt;</span>
+<span class="tag">&lt;/filter-mapping&gt;</span>
+
+<span class="tag">&lt;filter&gt;</span>
+    <span class="tag">&lt;display-name&gt;</span>EventBridgeFilter<span class="tag">&lt;/display-name&gt;</span>
+    <span class="tag">&lt;filter-name&gt;</span>EventBridgeFilter<span class="tag">&lt;/filter-name&gt;</span>
+    <span class="tag">&lt;filter-class&gt;</span>org.apache.deltaspike.servlet.impl.event.EventBridgeFilter<span class="tag">&lt;/filter-class&gt;</span>
+<span class="tag">&lt;/filter&gt;</span>
+<span class="tag">&lt;filter-mapping&gt;</span>
+    <span class="tag">&lt;filter-name&gt;</span>EventBridgeFilter<span class="tag">&lt;/filter-name&gt;</span>
+    <span class="tag">&lt;url-pattern&gt;</span>/*<span class="tag">&lt;/url-pattern&gt;</span>
+<span class="tag">&lt;/filter-mapping&gt;</span></code></pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_injectable_servlet_objects">Injectable Servlet objects</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>The DeltaSpike Servlet module contains producers for many objects of a
+Servlet environment. All produces are using the special qualifier
+<code>@DeltaSpike</code> for compatibility with CDI 1.1, which supports the
+injection of some Servlet objects out of the box.</p>
+</div>
+<div class="paragraph">
+<p>The following code shows the general injection pattern to use for all objects.</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@Inject</span> <span class="annotation">@DeltaSpike</span>
+<span class="directive">private</span> ServletObject servletObject;</code></pre>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_servletcontext">ServletContext</h3>
+<div class="paragraph">
+<p>The <code>ServletContext</code> is made available in the application scope. It can
+be injected into any CDI bean like this:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@Inject</span> <span class="annotation">@DeltaSpike</span>
+<span class="directive">private</span> ServletContext servletContext;</code></pre>
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_servletrequest_httpservletrequest">ServletRequest / HttpServletRequest</h3>
+<div class="paragraph">
+<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>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@Inject</span> <span class="annotation">@DeltaSpike</span>
+<span class="directive">private</span> ServletRequest request;</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>In case of HTTP requests you can also inject the <code>HttpServletRequest</code>:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@Inject</span> <span class="annotation">@DeltaSpike</span>
+<span class="directive">private</span> HttpServletRequest request;</code></pre>
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_servletresponse_httpservletresponse">ServletResponse / HttpServletResponse</h3>
+<div class="paragraph">
+<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>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@Inject</span> <span class="annotation">@DeltaSpike</span>
+<span class="directive">private</span> ServletResponse response;</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>In case of HTTP requests you can also inject the <code>HttpServletResponse</code>:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@Inject</span> <span class="annotation">@DeltaSpike</span>
+<span class="directive">private</span> HttpServletResponse response;</code></pre>
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_httpsession">HttpSession</h3>
+<div class="paragraph">
+<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>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@Inject</span> <span class="annotation">@DeltaSpike</span>
+<span class="directive">private</span> HttpSession session;</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Please note that injecting the session this way will force the creation
+of a session.</p>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_principal">Principal</h3>
+<div class="paragraph">
+<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>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@Inject</span> <span class="annotation">@DeltaSpike</span>
+<span class="directive">private</span> <span class="predefined-type">Principal</span> principal;</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>The <code>Principal</code> is obtained by calling <code>getUserPrincipal()</code> on the
+<code>HttpServletRequest</code>.</p>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_servlet_event_propagation">Servlet event propagation</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<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>
+</div>
+<div class="paragraph">
+<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>
+</div>
+<div class="paragraph">
+<p>The following sections will show which concrete Servlet objects are
+supported and how their lifecycle can be observed.</p>
+</div>
+<div class="sect2">
+<h3 id="_servlet_context_lifecycle_events">Servlet context lifecycle events</h3>
+<div class="paragraph">
+<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>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="directive">public</span> <span class="type">void</span> onCreate(<span class="annotation">@Observes</span> <span class="annotation">@Initialized</span> ServletContext context) {
+    <span class="predefined-type">System</span>.out.println(<span class="string"><span class="delimiter">&quot;</span><span class="content">Initialized ServletContext: </span><span class="delimiter">&quot;</span></span> + context.getServletContextName());
+}
+
+<span class="directive">public</span> <span class="type">void</span> onDestroy(<span class="annotation">@Observes</span> <span class="annotation">@Destroyed</span> ServletContext context) {
+    <span class="predefined-type">System</span>.out.println(<span class="string"><span class="delimiter">&quot;</span><span class="content">Destroyed ServletContext: </span><span class="delimiter">&quot;</span></span> + context.getServletContextName());
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<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>
+<div class="listingblock">
+<div class="content">
+<pre>org.apache.deltaspike.servlet.impl.event.EventBridgeContextListener</pre>
+</div>
+</div>
+<div class="paragraph">
+<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>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_request_and_response_lifecycle_events">Request and response lifecycle events</h3>
+<div class="paragraph">
+<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>
+</div>
+<div class="paragraph">
+<p>The following example shows how to observe lifecycle events for the
+request:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="directive">public</span> <span class="type">void</span> onCreate(<span class="annotation">@Observes</span> <span class="annotation">@Initialized</span> HttpServletRequest request) {
+    <span class="predefined-type">System</span>.out.println(<span class="string"><span class="delimiter">&quot;</span><span class="content">Starting to process request for: </span><span class="delimiter">&quot;</span></span> + request.getRequestURI());
+}
+
+<span class="directive">public</span> <span class="type">void</span> onDestroy(<span class="annotation">@Observes</span> <span class="annotation">@Destroyed</span> HttpServletRequest request) {
+    <span class="predefined-type">System</span>.out.println(<span class="string"><span class="delimiter">&quot;</span><span class="content">Finished processing request for: </span><span class="delimiter">&quot;</span></span> + request.getRequestURI());
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Observing lifecycle events for the response works the same way:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="directive">public</span> <span class="type">void</span> onCreate(<span class="annotation">@Observes</span> <span class="annotation">@Initialized</span> HttpServletResponse response) {
+    <span class="predefined-type">System</span>.out.println(<span class="string"><span class="delimiter">&quot;</span><span class="content">HttpServletResponse created</span><span class="delimiter">&quot;</span></span>);
+}
+
+<span class="directive">public</span> <span class="type">void</span> onDestroy(<span class="annotation">@Observes</span> <span class="annotation">@Destroyed</span> HttpServletResponse response) {
+    <span class="predefined-type">System</span>.out.println(<span class="string"><span class="delimiter">&quot;</span><span class="content">HttpServletResponse destroyed</span><span class="delimiter">&quot;</span></span>);
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<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&#8217;s deactivation mechanism to deactivate the following
+class:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre>org.apache.deltaspike.servlet.impl.event.EventBridgeFilter</pre>
+</div>
+</div>
+<div class="paragraph">
+<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>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_session_lifecycle_events">Session lifecycle events</h3>
+<div class="paragraph">
+<p>The last category of events supported by the DeltaSpike Servlet module
+are the lifecycle events for the user&#8217;s HTTP session. The following
+example shows how these events can be observed from a regular CDI bean.</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="directive">public</span> <span class="type">void</span> onCreate(<span class="annotation">@Observes</span> <span class="annotation">@Initialized</span> HttpSession session) {
+    <span class="predefined-type">System</span>.out.println(<span class="string"><span class="delimiter">&quot;</span><span class="content">Session created: </span><span class="delimiter">&quot;</span></span> + session.getId());
+}
+
+<span class="directive">public</span> <span class="type">void</span> onDestroy(<span class="annotation">@Observes</span> <span class="annotation">@Destroyed</span> HttpSession session) {
+    <span class="predefined-type">System</span>.out.println(<span class="string"><span class="delimiter">&quot;</span><span class="content">Session destroyed: </span><span class="delimiter">&quot;</span></span> + session.getId());
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<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>
+<div class="listingblock">
+<div class="content">
+<pre>org.apache.deltaspike.servlet.impl.event.EventBridgeSessionListener</pre>
+</div>
+</div>
+<div class="paragraph">
+<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>
+</div>
+</div>
+			</div>
+
+			<hr>
+
+			<footer>
+				<p>Copyright © 2011-2014 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 -->
+
+</body>
+</html>
\ No newline at end of file

Added: websites/staging/deltaspike/trunk/content/documentation/source.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/documentation/source.html (added)
+++ websites/staging/deltaspike/trunk/content/documentation/source.html Thu Sep 11 14:16:50 2014
@@ -0,0 +1,310 @@
+<!DOCTYPE html>
+<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>Get Source and compile it</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="http://deltaspike.apache.org/resources/css/bootstrap.css" rel="stylesheet">
+<link href="http://deltaspike.apache.org/resources/css/bootstrap-responsive.css" rel="stylesheet">
+
+<style type="text/css">
+/* Foundation stylesheet for CodeRay (to match GitHub theme) | MIT License | http://foundation.zurb.com */
+table.CodeRay { border-collapse: collapse; padding: 2px; margin-bottom: 0; border: 0; background: transparent; }
+table.CodeRay td { padding: 0 .5em; vertical-align: top; }
+table.CodeRay td.line-numbers { text-align: right; color: #999; border-right: 1px solid #e5e5e5; padding-left: 0; }
+span.line-numbers { border-right: 1px solid #E5E5E5; color: #999; display: inline-block; margin-right: 0.5em; padding-right: 0.5em; }
+.CodeRay td.line-numbers strong, .CodeRay span.line-numbers strong { font-weight: normal; }
+.CodeRay .debug { color: white !important; background: blue !important; }
+.CodeRay .annotation { color: #007; }
+.CodeRay .attribute-name { color: #f08; }
+.CodeRay .attribute-value { color: #700; }
+.CodeRay .binary { color: #509; }
+.CodeRay .comment  { color: #999; font-style: italic; }
+.CodeRay .char { color: #04D; }
+.CodeRay .char .content { color: #04D; }
+.CodeRay .char .delimiter { color: #039; }
+.CodeRay .class { color: #458; }
+.CodeRay .complex { color: #A08; }
+.CodeRay .constant { color: teal; }
+.CodeRay .color { color: #0A0; }
+.CodeRay .class-variable { color: #369; }
+.CodeRay .decorator { color: #B0B; }
+.CodeRay .definition { color: #099; }
+.CodeRay .directive { color: #088; }
+.CodeRay .delimiter { color: black; }
+.CodeRay .doc { color: #970; }
+.CodeRay .doctype { color: #34b; }
+.CodeRay .doc-string { color: #D42; }
+.CodeRay .escape  { color: #666; }
+.CodeRay .entity { color: #800; }
+.CodeRay .error { color: #808; }
+.CodeRay .exception { color: #C00; }
+.CodeRay .filename { color: #099; }
+.CodeRay .function { color: #900; }
+.CodeRay .global-variable { color: teal; }
+.CodeRay .hex { color: #058; }
+.CodeRay .integer  { color: #099; }
+.CodeRay .include { color: #B44; }
+.CodeRay .inline { color: black; }
+.CodeRay .inline .inline { background: #ccc; }
+.CodeRay .inline .inline .inline { background: #bbb; }
+.CodeRay .inline .inline-delimiter { color: #D14; }
+.CodeRay .inline-delimiter { color: #D14; }
+.CodeRay .important { color: #f00; }
+.CodeRay .interpreted { color: #B2B; }
+.CodeRay .instance-variable { color: teal; }
+.CodeRay .label { color: #970; }
+.CodeRay .local-variable { color: #963; }
+.CodeRay .octal { color: #40E; }
+.CodeRay .predefined { color: #369; }
+.CodeRay .preprocessor { color: #579; }
+.CodeRay .pseudo-class { color: #00C; }
+.CodeRay .predefined-type { color: #074; }
+.CodeRay .reserved, .keyword  { color: #000; }
+.CodeRay .key { color: #808; }
+.CodeRay .key .delimiter { color: #606; }
+.CodeRay .key .char { color: #80f; }
+.CodeRay .value { color: #088; }
+.CodeRay .regexp { background-color: #fff0ff; }
+.CodeRay .regexp .content { color: #808; }
+.CodeRay .regexp .delimiter { color: #404; }
+.CodeRay .regexp .modifier { color: #C2C; }
+.CodeRay .regexp .function  { color: #404; font-weight: bold; }
+.CodeRay .string { color: #D20; }
+.CodeRay .string .string { }
+.CodeRay .string .string .string { background-color: #ffd0d0; }
+.CodeRay .string .content { color: #D14; }
+.CodeRay .string .char { color: #D14; }
+.CodeRay .string .delimiter { color: #D14; }
+.CodeRay .shell { color: #D14; }
+.CodeRay .shell .content { }
+.CodeRay .shell .delimiter { color: #D14; }
+.CodeRay .symbol { color: #990073; }
+.CodeRay .symbol .content { color: #A60; }
+.CodeRay .symbol .delimiter { color: #630; }
+.CodeRay .tag, .CodeRay .attribute-name { color: #070; }
+.CodeRay .tag-special { color: #D70; }
+.CodeRay .type { color: #339; }
+.CodeRay .variable  { color: #036; }
+.CodeRay .insert { background: #afa; }
+.CodeRay .delete { background: #faa; }
+.CodeRay .change { color: #aaf; background: #007; }
+.CodeRay .head { color: #f8f; background: #505; }
+.CodeRay .insert .insert { color: #080; }
+.CodeRay .delete .delete { color: #800; }
+.CodeRay .change .change { color: #66f; }
+.CodeRay .head .head { color: #f4f; }
+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 logocolor"
+					href="http://deltaspike.apache.org/index.html">Apache
+					DeltaSpike</a>
+				<div class="nav-collapse">
+					<ul class="nav">
+						<li class="active"><a
+							href="http://deltaspike.apache.org/index.html">Home</a></li>
+						<li><a href="http://deltaspike.apache.org/documentation">Documentation</a></li>
+						<li><a href="http://deltaspike.apache.org/source.html">Source</a></li>
+						<li><a href="http://deltaspike.apache.org/download.html">Download</a></li>
+						<li><a href="http://deltaspike.apache.org/community.html">Community</a></li>
+						<!-- <li><a href="./support.html">Support</a></li>  -->
+						<li><a href="http://deltaspike.apache.org/news.html">News</a></li>
+						<li><a
+							href="http://deltaspike.apache.org/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>Get Source and compile it</h1>
+                </div>
+
+				<div id="toc" class="toc2">
+       	 		<ul class="sectlevel1">
+<li><a href="#_introduction">Introduction</a></li>
+<li><a href="#_scm_repository">SCM / Repository</a></li>
+<li>
+<ul class="sectlevel2">
+<li><a href="#_initial_em_checkout_em">Initial <em>checkout</em></a></li>
+<li><a href="#_update_existing_clone">Update existing clone</a></li>
+<li><a href="#_read_only_mirrors">Read-only Mirrors</a></li>
+<li>
+<ul class="sectlevel3">
+<li><a href="#_github_mirror">GitHub-Mirror</a></li>
+</ul>
+</li>
+<li><a href="#_git_workflow">GIT Workflow</a></li>
+</ul>
+</li>
+<li><a href="#_build">Build</a></li>
+<li><a href="#_tools_ide">Tools / IDE</a></li>
+<li>
+<ul class="sectlevel2">
+<li><a href="#_intellij">IntelliJ</a></li>
+<li><a href="#eclipse">Eclipse</a></li>
+</ul>
+</li>
+</ul>
+       	 		<hr>	
+       	 		
+				<div class="sect1">
+<h2 id="_introduction">Introduction</h2>
+<div class="sectionbody">
+
+</div>
+</div>
+<div class="sect1">
+<h2 id="_scm_repository">SCM / Repository</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>We are using GIT as a Version Control System. The official GIT
+repository of the project is available
+<a href="https://git-wip-us.apache.org/repos/asf/deltaspike.git">here</a>.</p>
+</div>
+<div class="sect2">
+<h3 id="_initial_em_checkout_em">Initial <em>checkout</em></h3>
+<div class="listingblock">
+<div class="content">
+<pre>git clone https://git-wip-us.apache.org/repos/asf/deltaspike.git</pre>
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_update_existing_clone">Update existing clone</h3>
+<div class="listingblock">
+<div class="content">
+<pre>git pull --rebase</pre>
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_read_only_mirrors">Read-only Mirrors</h3>
+<div class="sect3">
+<h4 id="_github_mirror">GitHub-Mirror</h4>
+<div class="listingblock">
+<div class="content">
+<pre>git clone https://github.com/apache/deltaspike</pre>
+</div>
+</div>
+<div class="paragraph">
+<p>More information can be found <a href="https://help.github.com/articles/which-remote-url-should-i-use">here</a>.</p>
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_git_workflow">GIT Workflow</h3>
+<div class="paragraph">
+<p>We follow an <a href="../suggested-git-workflows.html">unified GIT workflow</a> to
+keep the commit history straight and therefore simple and clean. General
+details about GIT at Apache are available
+<a href="http://wiki.apache.org/couchdb/Git_At_Apache_Guide">here</a> and at
+<a href="http://git-wip-us.apache.org">http://git-wip-us.apache.org</a>.</p>
+</div>
+<div class="paragraph">
+<p><strong>Hint:</strong></p>
+</div>
+<div class="paragraph">
+<p>If you are new to Git you might like to try the
+<a href="http://git.or.cz/course/svn.html">Git guide for subversion users</a> or have
+a look at the <a href="http://git-scm.com/book">Git community book</a>.</p>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_build">Build</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>So now you probably want to <strong><code>build the code</code></strong>. So follow the
+instructions <a href="build.html">here</a></p>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_tools_ide">Tools / IDE</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>Commits (and in the best case also patches), have to follow our
+"formatting rules". The following section provides settings for IDEs
+used by us.</p>
+</div>
+<div class="sect2">
+<h3 id="_intellij">IntelliJ</h3>
+<div class="paragraph">
+<p><a href="http://deltaspike.apache.org/resources/files/settings.jar">Attached</a> you can find the settings
+for formatting the source code. Import them via File | Import
+Settings&#8230;</p>
+</div>
+</div>
+<div class="sect2">
+<h3 id="eclipse">Eclipse</h3>
+<div class="paragraph">
+<p>For Eclipse you can use this
+<a href="http://deltaspike.apache.org/resources/files/deltaspike-code-conventions.xml">Code Formatter Profile</a>. Import it via Window | Preferences | Java | Code Style | Formatter</p>
+</div>
+</div>
+</div>
+</div>
+			</div>
+
+			<hr>
+
+			<footer>
+				<p>Copyright © 2011-2014 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 -->
+
+</body>
+</html>
\ No newline at end of file

Added: websites/staging/deltaspike/trunk/content/documentation/spi.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/documentation/spi.html (added)
+++ websites/staging/deltaspike/trunk/content/documentation/spi.html Thu Sep 11 14:16:50 2014
@@ -0,0 +1,344 @@
+<!DOCTYPE html>
+<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>DeltaSpike Service Provider Interface (SPI)</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="http://deltaspike.apache.org/resources/css/bootstrap.css" rel="stylesheet">
+<link href="http://deltaspike.apache.org/resources/css/bootstrap-responsive.css" rel="stylesheet">
+
+<style type="text/css">
+/* Foundation stylesheet for CodeRay (to match GitHub theme) | MIT License | http://foundation.zurb.com */
+table.CodeRay { border-collapse: collapse; padding: 2px; margin-bottom: 0; border: 0; background: transparent; }
+table.CodeRay td { padding: 0 .5em; vertical-align: top; }
+table.CodeRay td.line-numbers { text-align: right; color: #999; border-right: 1px solid #e5e5e5; padding-left: 0; }
+span.line-numbers { border-right: 1px solid #E5E5E5; color: #999; display: inline-block; margin-right: 0.5em; padding-right: 0.5em; }
+.CodeRay td.line-numbers strong, .CodeRay span.line-numbers strong { font-weight: normal; }
+.CodeRay .debug { color: white !important; background: blue !important; }
+.CodeRay .annotation { color: #007; }
+.CodeRay .attribute-name { color: #f08; }
+.CodeRay .attribute-value { color: #700; }
+.CodeRay .binary { color: #509; }
+.CodeRay .comment  { color: #999; font-style: italic; }
+.CodeRay .char { color: #04D; }
+.CodeRay .char .content { color: #04D; }
+.CodeRay .char .delimiter { color: #039; }
+.CodeRay .class { color: #458; }
+.CodeRay .complex { color: #A08; }
+.CodeRay .constant { color: teal; }
+.CodeRay .color { color: #0A0; }
+.CodeRay .class-variable { color: #369; }
+.CodeRay .decorator { color: #B0B; }
+.CodeRay .definition { color: #099; }
+.CodeRay .directive { color: #088; }
+.CodeRay .delimiter { color: black; }
+.CodeRay .doc { color: #970; }
+.CodeRay .doctype { color: #34b; }
+.CodeRay .doc-string { color: #D42; }
+.CodeRay .escape  { color: #666; }
+.CodeRay .entity { color: #800; }
+.CodeRay .error { color: #808; }
+.CodeRay .exception { color: #C00; }
+.CodeRay .filename { color: #099; }
+.CodeRay .function { color: #900; }
+.CodeRay .global-variable { color: teal; }
+.CodeRay .hex { color: #058; }
+.CodeRay .integer  { color: #099; }
+.CodeRay .include { color: #B44; }
+.CodeRay .inline { color: black; }
+.CodeRay .inline .inline { background: #ccc; }
+.CodeRay .inline .inline .inline { background: #bbb; }
+.CodeRay .inline .inline-delimiter { color: #D14; }
+.CodeRay .inline-delimiter { color: #D14; }
+.CodeRay .important { color: #f00; }
+.CodeRay .interpreted { color: #B2B; }
+.CodeRay .instance-variable { color: teal; }
+.CodeRay .label { color: #970; }
+.CodeRay .local-variable { color: #963; }
+.CodeRay .octal { color: #40E; }
+.CodeRay .predefined { color: #369; }
+.CodeRay .preprocessor { color: #579; }
+.CodeRay .pseudo-class { color: #00C; }
+.CodeRay .predefined-type { color: #074; }
+.CodeRay .reserved, .keyword  { color: #000; }
+.CodeRay .key { color: #808; }
+.CodeRay .key .delimiter { color: #606; }
+.CodeRay .key .char { color: #80f; }
+.CodeRay .value { color: #088; }
+.CodeRay .regexp { background-color: #fff0ff; }
+.CodeRay .regexp .content { color: #808; }
+.CodeRay .regexp .delimiter { color: #404; }
+.CodeRay .regexp .modifier { color: #C2C; }
+.CodeRay .regexp .function  { color: #404; font-weight: bold; }
+.CodeRay .string { color: #D20; }
+.CodeRay .string .string { }
+.CodeRay .string .string .string { background-color: #ffd0d0; }
+.CodeRay .string .content { color: #D14; }
+.CodeRay .string .char { color: #D14; }
+.CodeRay .string .delimiter { color: #D14; }
+.CodeRay .shell { color: #D14; }
+.CodeRay .shell .content { }
+.CodeRay .shell .delimiter { color: #D14; }
+.CodeRay .symbol { color: #990073; }
+.CodeRay .symbol .content { color: #A60; }
+.CodeRay .symbol .delimiter { color: #630; }
+.CodeRay .tag, .CodeRay .attribute-name { color: #070; }
+.CodeRay .tag-special { color: #D70; }
+.CodeRay .type { color: #339; }
+.CodeRay .variable  { color: #036; }
+.CodeRay .insert { background: #afa; }
+.CodeRay .delete { background: #faa; }
+.CodeRay .change { color: #aaf; background: #007; }
+.CodeRay .head { color: #f8f; background: #505; }
+.CodeRay .insert .insert { color: #080; }
+.CodeRay .delete .delete { color: #800; }
+.CodeRay .change .change { color: #66f; }
+.CodeRay .head .head { color: #f4f; }
+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 logocolor"
+					href="http://deltaspike.apache.org/index.html">Apache
+					DeltaSpike</a>
+				<div class="nav-collapse">
+					<ul class="nav">
+						<li class="active"><a
+							href="http://deltaspike.apache.org/index.html">Home</a></li>
+						<li><a href="http://deltaspike.apache.org/documentation">Documentation</a></li>
+						<li><a href="http://deltaspike.apache.org/source.html">Source</a></li>
+						<li><a href="http://deltaspike.apache.org/download.html">Download</a></li>
+						<li><a href="http://deltaspike.apache.org/community.html">Community</a></li>
+						<!-- <li><a href="./support.html">Support</a></li>  -->
+						<li><a href="http://deltaspike.apache.org/news.html">News</a></li>
+						<li><a
+							href="http://deltaspike.apache.org/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>DeltaSpike Service Provider Interface (SPI)</h1>
+                </div>
+
+				<div id="toc" class="toc2">
+       	 		<ul class="sectlevel1">
+<li><a href="#_introduction">Introduction</a></li>
+<li><a href="#_deactivatable">Deactivatable</a></li>
+<li>
+<ul class="sectlevel2">
+<li><a href="#_classdeactivator">ClassDeactivator</a></li>
+</ul>
+</li>
+<li><a href="#_configsource">ConfigSource</a></li>
+<li>
+<ul class="sectlevel2">
+<li><a href="#_configsourceprovider">ConfigSourceProvider</a></li>
+<li><a href="#_baseconfigpropertyproducer">BaseConfigPropertyProducer</a></li>
+</ul>
+</li>
+<li><a href="#_interceptorstrategy">InterceptorStrategy</a></li>
+<li><a href="#_global_alternative">Global Alternative</a></li>
+</ul>
+       	 		<hr>	
+       	 		
+				<div class="sect1">
+<h2 id="_introduction">Introduction</h2>
+<div class="sectionbody">
+
+</div>
+</div>
+<div class="sect1">
+<h2 id="_deactivatable">Deactivatable</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>This mechanism is only used for artifacts <strong>like</strong> implementations of
+(<code>javax.enterprise.inject.spi.Extension</code>) which <strong>can&#8217;t</strong> be deactivated
+with std. CDI mechanisms.</p>
+</div>
+<div class="paragraph">
+<p>This interface is just a marker interface which is implemented by all
+pre-configured DeltaSpike artifacts which can be deactivated manually
+(e.g. to improve the performance if a part isn&#8217;t needed, to provide a
+custom implementation if the default implementation isn&#8217;t pluggable by
+default or to bypass an implementation which causes an issue (in this
+case please also <strong>contact us</strong> and we will fix it)).</p>
+</div>
+<div class="paragraph">
+<p>To deactivate a class it&#8217;s required to implement <code>ClassDeactivator</code>.
+Returning <em>false</em> or <em>true</em> allows to de-/activate the class in
+question. Retuning null means that the current class-deactivator doesn&#8217;t
+have information about the class in question and can&#8217;t provide a result.
+Since <code>ClassDeactivator</code> implementations are configured with the
+low-level config of DeltaSpike, the class-deactivator with the highest
+ordinal has the final decision. DeltaSpike itself doesn&#8217;t deactivate an
+implementation, however, an add-on or a 3rd party portable CDI extension
+based on DeltaSpike (Core+) can use the concept to deactivate a default
+implementation of DeltaSpike in favour of its own implementation.</p>
+</div>
+<div class="paragraph">
+<p><strong>Attention</strong>: due to the ordinal feature of the low-level config
+approach it&#8217;s possible that a class-deactivator with a higher ordinal,
+e.g. used in a concrete project, can re-activate a deactivated
+implementation.<br>
+<strong>Please note</strong> that you might have to deactivate the parts of the add-on
+or 3rd party CDI extension which relies on its own implementation.
+Therefore, you should <strong>be really careful with re-activation</strong>.) The
+implementation should be stateless because the result will be cached and
+as soon as everything is initialized the class-deactivators won&#8217;t be
+used any longer.</p>
+</div>
+<div class="sect2">
+<h3 id="_classdeactivator">ClassDeactivator</h3>
+<div class="paragraph">
+<p>A class-deactivator allows to specify deactivated classes.</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="comment">//This class needs to be configured via one of the supported config sources!</span>
+<span class="directive">public</span> <span class="type">class</span> <span class="class">CustomClassDeactivator</span> <span class="directive">implements</span> ClassDeactivator
+{
+    <span class="annotation">@Override</span>
+    <span class="directive">public</span> <span class="predefined-type">Boolean</span> isActivated(<span class="predefined-type">Class</span>&lt;? <span class="directive">extends</span> Deactivatable&gt; targetClass)
+    {
+        <span class="keyword">if</span> (targetClass.equals(MyClass.class))
+        {
+            <span class="keyword">return</span> <span class="predefined-type">Boolean</span>.FALSE;
+        }
+        <span class="keyword">return</span> <span class="predefined-constant">null</span>; <span class="comment">//no result for the given class</span>
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>A class-deactivator will be resolved from the environment via the
+default resolvers or via a custom resolver which allows to use any type
+of configuration-format. (see
+<code>org.apache.deltaspike.core.api.config.ConfigResolver</code>). The key is the
+fully qualified name of the interface
+(<code>org.apache.deltaspike.core.spi.activation.ClassDeactivator</code>).</p>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_configsource">ConfigSource</h2>
+<div class="sectionbody">
+<div class="sect2">
+<h3 id="_configsourceprovider">ConfigSourceProvider</h3>
+
+</div>
+<div class="sect2">
+<h3 id="_baseconfigpropertyproducer">BaseConfigPropertyProducer</h3>
+
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_interceptorstrategy">InterceptorStrategy</h2>
+<div class="sectionbody">
+
+</div>
+</div>
+<div class="sect1">
+<h2 id="_global_alternative">Global Alternative</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>There are several application servers (using CDI 1.0) which can&#8217;t handle
+alternative CDI beans correctly (e.g. due to a too strict interpretation
+or a broken implementation). Therefore, DeltaSpike allows to use the
+std. <code>@Alternative</code> annotation and an additional config entry for
+DeltaSpike which allows to use the alternative implementation as a
+global alternative.</p>
+</div>
+<div class="paragraph">
+<p><strong>Std. CDI alternative implementation (without the required XML config)</strong></p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="directive">public</span> <span class="type">class</span> <span class="class">CustomBean</span>
+{
+}
+
+<span class="annotation">@Alternative</span>
+<span class="comment">//...</span>
+<span class="directive">public</span> <span class="type">class</span> <span class="class">AlternativeCustomBean</span> <span class="directive">extends</span> CustomBean
+{
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Instead of configuring the alternative in the beans.xml, a global
+alternative needs to be configured in
+/META-INF/apache-deltaspike.properties. CDI 1.1 should fix this issue
+and migrating to it means to remove the config entry for DeltaSpike
+again and move to the std. CDI config approach.</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre>custom.CustomBean=custom.AlternativeCustomBean</pre>
+</div>
+</div>
+</div>
+</div>
+			</div>
+
+			<hr>
+
+			<footer>
+				<p>Copyright © 2011-2014 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 -->
+
+</body>
+</html>
\ No newline at end of file

Added: websites/staging/deltaspike/trunk/content/documentation/test-control.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/documentation/test-control.html (added)
+++ websites/staging/deltaspike/trunk/content/documentation/test-control.html Thu Sep 11 14:16:50 2014
@@ -0,0 +1,707 @@
+<!DOCTYPE html>
+<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>Test-Control 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="http://deltaspike.apache.org/resources/css/bootstrap.css" rel="stylesheet">
+<link href="http://deltaspike.apache.org/resources/css/bootstrap-responsive.css" rel="stylesheet">
+
+<style type="text/css">
+/* Foundation stylesheet for CodeRay (to match GitHub theme) | MIT License | http://foundation.zurb.com */
+table.CodeRay { border-collapse: collapse; padding: 2px; margin-bottom: 0; border: 0; background: transparent; }
+table.CodeRay td { padding: 0 .5em; vertical-align: top; }
+table.CodeRay td.line-numbers { text-align: right; color: #999; border-right: 1px solid #e5e5e5; padding-left: 0; }
+span.line-numbers { border-right: 1px solid #E5E5E5; color: #999; display: inline-block; margin-right: 0.5em; padding-right: 0.5em; }
+.CodeRay td.line-numbers strong, .CodeRay span.line-numbers strong { font-weight: normal; }
+.CodeRay .debug { color: white !important; background: blue !important; }
+.CodeRay .annotation { color: #007; }
+.CodeRay .attribute-name { color: #f08; }
+.CodeRay .attribute-value { color: #700; }
+.CodeRay .binary { color: #509; }
+.CodeRay .comment  { color: #999; font-style: italic; }
+.CodeRay .char { color: #04D; }
+.CodeRay .char .content { color: #04D; }
+.CodeRay .char .delimiter { color: #039; }
+.CodeRay .class { color: #458; }
+.CodeRay .complex { color: #A08; }
+.CodeRay .constant { color: teal; }
+.CodeRay .color { color: #0A0; }
+.CodeRay .class-variable { color: #369; }
+.CodeRay .decorator { color: #B0B; }
+.CodeRay .definition { color: #099; }
+.CodeRay .directive { color: #088; }
+.CodeRay .delimiter { color: black; }
+.CodeRay .doc { color: #970; }
+.CodeRay .doctype { color: #34b; }
+.CodeRay .doc-string { color: #D42; }
+.CodeRay .escape  { color: #666; }
+.CodeRay .entity { color: #800; }
+.CodeRay .error { color: #808; }
+.CodeRay .exception { color: #C00; }
+.CodeRay .filename { color: #099; }
+.CodeRay .function { color: #900; }
+.CodeRay .global-variable { color: teal; }
+.CodeRay .hex { color: #058; }
+.CodeRay .integer  { color: #099; }
+.CodeRay .include { color: #B44; }
+.CodeRay .inline { color: black; }
+.CodeRay .inline .inline { background: #ccc; }
+.CodeRay .inline .inline .inline { background: #bbb; }
+.CodeRay .inline .inline-delimiter { color: #D14; }
+.CodeRay .inline-delimiter { color: #D14; }
+.CodeRay .important { color: #f00; }
+.CodeRay .interpreted { color: #B2B; }
+.CodeRay .instance-variable { color: teal; }
+.CodeRay .label { color: #970; }
+.CodeRay .local-variable { color: #963; }
+.CodeRay .octal { color: #40E; }
+.CodeRay .predefined { color: #369; }
+.CodeRay .preprocessor { color: #579; }
+.CodeRay .pseudo-class { color: #00C; }
+.CodeRay .predefined-type { color: #074; }
+.CodeRay .reserved, .keyword  { color: #000; }
+.CodeRay .key { color: #808; }
+.CodeRay .key .delimiter { color: #606; }
+.CodeRay .key .char { color: #80f; }
+.CodeRay .value { color: #088; }
+.CodeRay .regexp { background-color: #fff0ff; }
+.CodeRay .regexp .content { color: #808; }
+.CodeRay .regexp .delimiter { color: #404; }
+.CodeRay .regexp .modifier { color: #C2C; }
+.CodeRay .regexp .function  { color: #404; font-weight: bold; }
+.CodeRay .string { color: #D20; }
+.CodeRay .string .string { }
+.CodeRay .string .string .string { background-color: #ffd0d0; }
+.CodeRay .string .content { color: #D14; }
+.CodeRay .string .char { color: #D14; }
+.CodeRay .string .delimiter { color: #D14; }
+.CodeRay .shell { color: #D14; }
+.CodeRay .shell .content { }
+.CodeRay .shell .delimiter { color: #D14; }
+.CodeRay .symbol { color: #990073; }
+.CodeRay .symbol .content { color: #A60; }
+.CodeRay .symbol .delimiter { color: #630; }
+.CodeRay .tag, .CodeRay .attribute-name { color: #070; }
+.CodeRay .tag-special { color: #D70; }
+.CodeRay .type { color: #339; }
+.CodeRay .variable  { color: #036; }
+.CodeRay .insert { background: #afa; }
+.CodeRay .delete { background: #faa; }
+.CodeRay .change { color: #aaf; background: #007; }
+.CodeRay .head { color: #f8f; background: #505; }
+.CodeRay .insert .insert { color: #080; }
+.CodeRay .delete .delete { color: #800; }
+.CodeRay .change .change { color: #66f; }
+.CodeRay .head .head { color: #f4f; }
+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 logocolor"
+					href="http://deltaspike.apache.org/index.html">Apache
+					DeltaSpike</a>
+				<div class="nav-collapse">
+					<ul class="nav">
+						<li class="active"><a
+							href="http://deltaspike.apache.org/index.html">Home</a></li>
+						<li><a href="http://deltaspike.apache.org/documentation">Documentation</a></li>
+						<li><a href="http://deltaspike.apache.org/source.html">Source</a></li>
+						<li><a href="http://deltaspike.apache.org/download.html">Download</a></li>
+						<li><a href="http://deltaspike.apache.org/community.html">Community</a></li>
+						<!-- <li><a href="./support.html">Support</a></li>  -->
+						<li><a href="http://deltaspike.apache.org/news.html">News</a></li>
+						<li><a
+							href="http://deltaspike.apache.org/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>Test-Control Module</h1>
+                </div>
+
+				<div id="toc" class="toc2">
+       	 		<ul class="sectlevel1">
+<li><a href="#_intro">Intro</a></li>
+<li><a href="#_setup">Setup</a></li>
+<li>
+<ul class="sectlevel2">
+<li><a href="#_openwebbeans">OpenWebBeans</a></li>
+<li><a href="#_weld">Weld</a></li>
+</ul>
+</li>
+<li><a href="#_cditestrunner">CdiTestRunner</a></li>
+<li><a href="#__testcontrol">@TestControl</a></li>
+<li><a href="#_cditestsuiterunner">CdiTestSuiteRunner</a></li>
+<li><a href="#_project_stage_control">Project-Stage Control</a></li>
+<li><a href="#_optional_config">Optional Config</a></li>
+<li><a href="#_hints">Hints</a></li>
+<li><a href="#_optional_integrations">Optional Integrations</a></li>
+<li>
+<ul class="sectlevel2">
+<li><a href="#_mock_frameworks">Mock Frameworks</a></li>
+<li><a href="#_jsf_via_myfaces_test">JSF (via MyFaces-Test)</a></li>
+</ul>
+</li>
+<li><a href="#_mixed_tests">Mixed Tests</a></li>
+<li><a href="#_known_restrictions">Known Restrictions</a></li>
+<li>
+<ul class="sectlevel2">
+<li><a href="#_liquibase">Liquibase</a></li>
+</ul>
+</li>
+<li><a href="#_spi">SPI</a></li>
+<li>
+<ul class="sectlevel2">
+<li><a href="#_externalcontainer">ExternalContainer</a></li>
+</ul>
+</li>
+</ul>
+       	 		<hr>	
+       	 		
+				<div class="sect1">
+<h2 id="_intro">Intro</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>This module is available since version 0.6 and allows to write CDI based
+tests easily.</p>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_setup">Setup</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>Setup for the CDI implementation of your choice and the following
+test-dependencies:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="xml language-xml"><span class="tag">&lt;dependency&gt;</span>
+    <span class="tag">&lt;groupId&gt;</span>org.apache.deltaspike.modules<span class="tag">&lt;/groupId&gt;</span>
+    <span class="tag">&lt;artifactId&gt;</span>deltaspike-test-control-module-api<span class="tag">&lt;/artifactId&gt;</span>
+    <span class="tag">&lt;version&gt;</span>${ds.version}<span class="tag">&lt;/version&gt;</span>
+    <span class="tag">&lt;scope&gt;</span>test<span class="tag">&lt;/scope&gt;</span>
+<span class="tag">&lt;/dependency&gt;</span>
+<span class="tag">&lt;dependency&gt;</span>
+    <span class="tag">&lt;groupId&gt;</span>org.apache.deltaspike.modules<span class="tag">&lt;/groupId&gt;</span>
+    <span class="tag">&lt;artifactId&gt;</span>deltaspike-test-control-module-impl<span class="tag">&lt;/artifactId&gt;</span>
+    <span class="tag">&lt;version&gt;</span>${ds.version}<span class="tag">&lt;/version&gt;</span>
+    <span class="tag">&lt;scope&gt;</span>test<span class="tag">&lt;/scope&gt;</span>
+<span class="tag">&lt;/dependency&gt;</span></code></pre>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_openwebbeans">OpenWebBeans</h3>
+<div class="paragraph">
+<p>If you are using OpenWebBeans also add the following test-dependency</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="xml language-xml"> <span class="tag">&lt;dependency&gt;</span>
+     <span class="tag">&lt;groupId&gt;</span>org.apache.deltaspike.cdictrl<span class="tag">&lt;/groupId&gt;</span>
+     <span class="tag">&lt;artifactId&gt;</span>deltaspike-cdictrl-owb<span class="tag">&lt;/artifactId&gt;</span>
+     <span class="tag">&lt;version&gt;</span>${ds.version}<span class="tag">&lt;/version&gt;</span>
+     <span class="tag">&lt;scope&gt;</span>test<span class="tag">&lt;/scope&gt;</span>
+ <span class="tag">&lt;/dependency&gt;</span></code></pre>
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_weld">Weld</h3>
+<div class="paragraph">
+<p>If you are using Weld also add the following test-dependency</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="xml language-xml"><span class="tag">&lt;dependency&gt;</span>
+    <span class="tag">&lt;groupId&gt;</span>org.apache.deltaspike.cdictrl<span class="tag">&lt;/groupId&gt;</span>
+    <span class="tag">&lt;artifactId&gt;</span>deltaspike-cdictrl-weld<span class="tag">&lt;/artifactId&gt;</span>
+    <span class="tag">&lt;version&gt;</span>${ds.version}<span class="tag">&lt;/version&gt;</span>
+    <span class="tag">&lt;scope&gt;</span>test<span class="tag">&lt;/scope&gt;</span>
+<span class="tag">&lt;/dependency&gt;</span></code></pre>
+</div>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_cditestrunner">CdiTestRunner</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>JUnit Test-Runner to start/stop the CDI-Container autom. (per
+test-class) and one request and session per test-method:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@RunWith</span>(CdiTestRunner.class)
+<span class="directive">public</span> <span class="type">class</span> <span class="class">ContainerAndInjectionControl</span>
+{
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> ApplicationScopedBean applicationScopedBean;
+
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> SessionScopedBean sessionScopedBean;
+
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> RequestScopedBean requestScopedBean;
+
+    <span class="comment">//test the injected beans</span>
+}</code></pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="__testcontrol">@TestControl</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>@TestControl allows to change the default-behavior. In the following
+case only one session for all test-methods (of the test-class) will be
+created:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@RunWith</span>(CdiTestRunner.class)
+<span class="annotation">@TestControl</span>(startScopes = SessionScoped.class)
+<span class="directive">public</span> <span class="type">class</span> <span class="class">CustomizedScopeHandling</span>
+{
+    <span class="comment">//inject beans and test them</span>
+}</code></pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_cditestsuiterunner">CdiTestSuiteRunner</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>JUnit Test-Suite-Runner to start/stop the CDI-Container autom. (per
+test-suite):</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@RunWith</span>(CdiTestSuiteRunner.class)
+<span class="annotation">@Suite</span>.SuiteClasses({
+    TestX.class,
+    TestY.class
+})
+<span class="directive">public</span> <span class="type">class</span> <span class="class">SuiteLevelContainerControl</span>
+{
+}</code></pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_project_stage_control">Project-Stage Control</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>It&#8217;s possible to overrule the default-project-stage for unit-tests
+(ProjectStage.UnitTest.class):</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@RunWith</span>(CdiTestRunner.class)
+<span class="annotation">@TestControl</span>(projectStage = CustomTestStage.class)
+<span class="directive">public</span> <span class="type">class</span> <span class="class">TestStageControl</span>
+{
+    <span class="comment">//tests here will see project-stage CustomTestStage.class</span>
+
+    <span class="annotation">@Test</span>
+    <span class="annotation">@TestControl</span>(projectStage = ProjectStage.Development.class)
+    <span class="directive">public</span> <span class="type">void</span> checkDevEnv()
+    {
+    }
+
+    <span class="comment">//tests here will see project-stage CustomTestStage.class</span>
+}</code></pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_optional_config">Optional Config</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>It&#8217;s possible to set "deltaspike.testcontrol.stop_container" to "false"
+(via the std. DeltaSpike config). With that the CDI-Container will be
+started just once for all tests.</p>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_hints">Hints</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>Don&#8217;t forget to add a beans.xml in the test-module (e.g.
+src/test/resources/META-INF/beans.xml).</p>
+</div>
+<div class="paragraph">
+<p>If you are using OpenWebBeans as CDI implementation and you need to test
+EJBs as well, you can use deltaspike-cdictrl-openejb<br>
+org.apache.openejb:openejb-core (instead of deltaspike-cdictrl-owb).</p>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_optional_integrations">Optional Integrations</h2>
+<div class="sectionbody">
+<div class="sect2">
+<h3 id="_mock_frameworks">Mock Frameworks</h3>
+<div class="paragraph">
+<p>With v0.8+ it&#8217;s possible to mock CDI-Beans. Usually @Exclude (+
+project-stage) is enough, however, for some cases mocked beans might be
+easier. Therefore it&#8217;s possible to create (mock-)instances manually or
+via a mocking framework and add them e.g. via <code>DynamicMockManager</code>.</p>
+</div>
+<div class="paragraph">
+<p>If you need dependency-injection in the mocked instances, you can use
+<code>BeanProvider.injectFields(myMockedBean);</code>.</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@RunWith</span>(CdiTestRunner.class)
+<span class="directive">public</span> <span class="type">class</span> <span class="class">MockedRequestScopedBeanTest</span>
+{
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> RequestScopedBean requestScopedBean;
+
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> DynamicMockManager mockManager;
+
+    <span class="annotation">@Test</span>
+    <span class="directive">public</span> <span class="type">void</span> manualMock()
+    {
+        mockManager.addMock(<span class="keyword">new</span> RequestScopedBean() {
+            <span class="annotation">@Override</span>
+            <span class="directive">public</span> <span class="type">int</span> getCount()
+            {
+                <span class="keyword">return</span> <span class="integer">7</span>;
+            }
+        });
+
+        Assert.assertEquals(<span class="integer">7</span>, requestScopedBean.getCount());
+        requestScopedBean.increaseCount();
+        Assert.assertEquals(<span class="integer">7</span>, requestScopedBean.getCount());
+    }
+}
+
+<span class="annotation">@RequestScoped</span>
+<span class="directive">public</span> <span class="type">class</span> <span class="class">RequestScopedBean</span>
+{
+    <span class="directive">private</span> <span class="type">int</span> count = <span class="integer">0</span>;
+
+    <span class="directive">public</span> <span class="type">int</span> getCount()
+    {
+        <span class="keyword">return</span> count;
+    }
+
+    <span class="directive">public</span> <span class="type">void</span> increaseCount()
+    {
+        <span class="local-variable">this</span>.count++;
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Using a mocking framework makes no difference for adding the mock. E.g.
+via Mockito:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@RunWith</span>(CdiTestRunner.class)
+<span class="directive">public</span> <span class="type">class</span> <span class="class">MockitoMockedRequestScopedBeanTest</span>
+{
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> RequestScopedBean requestScopedBean;
+
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> DynamicMockManager mockManager;
+
+    <span class="annotation">@Test</span>
+    <span class="directive">public</span> <span class="type">void</span> mockitoMockAsCdiBean()
+    {
+        RequestScopedBean mockedRequestScopedBean = mock(RequestScopedBean.class);
+        when(mockedRequestScopedBean.getCount()).thenReturn(<span class="integer">7</span>);
+        mockManager.addMock(mockedRequestScopedBean);
+
+        Assert.assertEquals(<span class="integer">7</span>, requestScopedBean.getCount());
+        requestScopedBean.increaseCount();
+        Assert.assertEquals(<span class="integer">7</span>, requestScopedBean.getCount());
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Since CDI implementations like OpenWebBeans use a lot of optimizations,
+it&#8217;s required to handle mocks for application-scoped beans differently -
+e.g.:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@RunWith</span>(CdiTestRunner.class)
+<span class="directive">public</span> <span class="type">class</span> <span class="class">MockedApplicationScopedBeanTest</span>
+{
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> ApplicationScopedBean applicationScopedBean;
+
+    <span class="annotation">@BeforeClass</span>
+    <span class="directive">public</span> <span class="directive">static</span> <span class="type">void</span> init()
+    {
+        ApplicationMockManager applicationMockManager = BeanProvider.getContextualReference(ApplicationMockManager.class);
+        applicationMockManager.addMock(<span class="keyword">new</span> MockedApplicationScopedBean());
+    }
+
+    <span class="annotation">@Test</span>
+    <span class="directive">public</span> <span class="type">void</span> manualMock()
+    {
+        Assert.assertEquals(<span class="integer">14</span>, applicationScopedBean.getCount());
+        applicationScopedBean.increaseCount();
+        Assert.assertEquals(<span class="integer">14</span>, applicationScopedBean.getCount());
+    }
+}
+
+<span class="annotation">@ApplicationScoped</span>
+<span class="directive">public</span> <span class="type">class</span> <span class="class">ApplicationScopedBean</span>
+{
+    <span class="directive">private</span> <span class="type">int</span> count = <span class="integer">0</span>;
+
+    <span class="directive">public</span> <span class="type">int</span> getCount()
+    {
+        <span class="keyword">return</span> count;
+    }
+
+    <span class="directive">public</span> <span class="type">void</span> increaseCount()
+    {
+        <span class="local-variable">this</span>.count++;
+    }
+}
+
+<span class="annotation">@Typed</span>() <span class="comment">//exclude it for the cdi type-check</span>
+<span class="directive">public</span> <span class="type">class</span> <span class="class">MockedApplicationScopedBean</span> <span class="directive">extends</span> ApplicationScopedBean
+{
+    <span class="annotation">@Override</span>
+    <span class="directive">public</span> <span class="type">int</span> getCount()
+    {
+        <span class="keyword">return</span> <span class="integer">14</span>;
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>However, <code>ApplicationMockManager</code> can be used for adding all mocks, if
+they should be active for the lifetime of the CDI-container.</p>
+</div>
+<div class="paragraph">
+<p>It&#8217;s also possible to mock qualified beans. Just add the
+literal-instance(s) as additional parameter(s) - e.g.:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@RunWith</span>(CdiTestRunner.class)
+<span class="directive">public</span> <span class="type">class</span> <span class="class">MockedQualifiedBeanTest</span>
+{
+    <span class="annotation">@Inject</span>
+    <span class="annotation">@MyQualifier</span>
+    <span class="directive">private</span> QualifiedBean qualifiedBean;
+
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> DynamicMockManager mockManager;
+
+    <span class="annotation">@Test</span>
+    <span class="directive">public</span> <span class="type">void</span> manualMockWithQualifier()
+    {
+        mockManager.addMock(<span class="keyword">new</span> QualifiedBean() {
+            <span class="annotation">@Override</span>
+            <span class="directive">public</span> <span class="type">int</span> getCount()
+            {
+                <span class="keyword">return</span> <span class="integer">21</span>;
+            }
+        }, AnnotationInstanceProvider.of(MyQualifier.class));
+
+        Assert.assertEquals(<span class="integer">21</span>, qualifiedBean.getCount());
+        qualifiedBean.increaseCount();
+        Assert.assertEquals(<span class="integer">21</span>, qualifiedBean.getCount());
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>In some cases it&#8217;s needed to use <code>@javax.enterprise.inject.Typed</code>.
+Mocking such typed beans can result in an
+<code>AmbiguousResolutionException</code>. Therefore it&#8217;s needed to exclude the
+mocked implementation via <code>@Exclude</code> or <code>@Typed()</code> (or a parametrized
+constructor) and specify the target-type via <code>@TypedMock</code>.</p>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_jsf_via_myfaces_test">JSF (via MyFaces-Test)</h3>
+<div class="paragraph">
+<p>add on of</p>
+</div>
+<div class="ulist">
+<ul>
+<li>
+<p>org.apache.deltaspike.testcontrol.impl.jsf.MockedJsf2TestContainer</p>
+</li>
+<li>
+<p>org.apache.deltaspike.testcontrol.impl.jsf.MockedJsfTestContainerAdapter</p>
+</li>
+<li>
+<p>org.apache.deltaspike.testcontrol.impl.jsf.MyFacesContainerAdapter</p>
+</li>
+<li>
+<p>org.apache.deltaspike.testcontrol.impl.jsf.MyFacesContainerPerTestMethodAdapter</p>
+</li>
+</ul>
+</div>
+<div class="paragraph">
+<p>as content to</p>
+</div>
+<div class="paragraph">
+<p>/META-INF/services/org.apache.deltaspike.testcontrol.spi.ExternalContainer</p>
+</div>
+<div class="paragraph">
+<p>(in your config-folder for tests e.g.: test/resources)</p>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_mixed_tests">Mixed Tests</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>Usually you should have one kind of tests per test-module. However, if
+you need to add e.g. a test without an external-container to your
+test-module which uses external-containers, you can annotate your test
+with:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@RunWith</span>(CdiTestRunner.class)
+<span class="annotation">@TestControl</span>(startExternalContainers = <span class="predefined-constant">false</span>)
+<span class="directive">public</span> <span class="type">class</span> <span class="class">JsfContainerTest</span>
+{
+    <span class="comment">//...</span>
+}</code></pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_known_restrictions">Known Restrictions</h2>
+<div class="sectionbody">
+<div class="sect2">
+<h3 id="_liquibase">Liquibase</h3>
+<div class="paragraph">
+<p>Liquibase invokes <code>#toString</code> in a <code>AfterDeploymentValidation</code> observer.
+<strong>that isn&#8217;t portable</strong> and therefore you have to deactivate the
+mocking-support via:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="directive">public</span> <span class="type">class</span> <span class="class">LiquibaseAwareClassDeactivator</span> <span class="directive">implements</span> ClassDeactivator {
+    <span class="annotation">@Override</span>
+    <span class="directive">public</span> <span class="predefined-type">Boolean</span> isActivated(<span class="predefined-type">Class</span>&lt;? <span class="directive">extends</span> Deactivatable&gt; targetClass) {
+        <span class="keyword">return</span> !<span class="string"><span class="delimiter">&quot;</span><span class="content">org.apache.deltaspike.testcontrol.impl.mock.MockExtension</span><span class="delimiter">&quot;</span></span>.equals(targetClass.getName());
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>and add <code>LiquibaseAwareClassDeactivator</code> to <code>/META-INF/apache-deltaspike.properties</code> - e.g.:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre>org.apache.deltaspike.core.spi.activation.ClassDeactivator=myPackage.LiquibaseAwareClassDeactivator</pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Further details are available at deactivatable.</p>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_spi">SPI</h2>
+<div class="sectionbody">
+<div class="sect2">
+<h3 id="_externalcontainer">ExternalContainer</h3>
+<div class="paragraph">
+<p>org.apache.deltaspike.testcontrol.spi.ExternalContainer allows to
+integrate containers which get started after the CDI container.
+Currently DeltaSpike provides:</p>
+</div>
+<div class="ulist">
+<ul>
+<li>
+<p>MockedJsf2TestContainer (integration with MyFaces-Test)</p>
+</li>
+</ul>
+</div>
+</div>
+</div>
+</div>
+			</div>
+
+			<hr>
+
+			<footer>
+				<p>Copyright © 2011-2014 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 -->
+
+</body>
+</html>
\ No newline at end of file



Mime
View raw message