deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rafab...@apache.org
Subject svn commit: r1624296 [6/7] - /deltaspike/site/trunk/content/documentation/
Date Thu, 11 Sep 2014 14:16:38 GMT
Added: deltaspike/site/trunk/content/documentation/partial-bean.html
URL: http://svn.apache.org/viewvc/deltaspike/site/trunk/content/documentation/partial-bean.html?rev=1624296&view=auto
==============================================================================
--- deltaspike/site/trunk/content/documentation/partial-bean.html (added)
+++ deltaspike/site/trunk/content/documentation/partial-bean.html Thu Sep 11 14:16:37 2014
@@ -0,0 +1,236 @@
+<!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>Partial-Bean</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>Partial-Bean</h1>
+                </div>
+
+				<div id="toc" class="toc2">
+       	 		<ul class="sectlevel1">
+<li><a href="#_usage">Usage</a></li>
+</ul>
+       	 		<hr>	
+       	 		
+				<div class="sect1">
+<h2 id="_usage">Usage</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>Partial beans allow you to implement a generic handler to replace manual
+implementations of interfaces (or abstract classes).</p>
+</div>
+<div class="paragraph">
+<p><code>@PartialBeanBinding</code> is the binding-annotation for creating a custom
+interface (/abstract class) to generic handler binding.</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@PartialBeanBinding</span>
+
+<span class="annotation">@Retention</span>(RUNTIME)
+<span class="annotation">@Target</span>(TYPE)
+<span class="directive">public</span> <span class="annotation">@interface</span> MyPartialBeanBinding {}
+
+<span class="annotation">@MyPartialBeanBinding</span>
+<span class="comment">//scope is optional</span>
+<span class="directive">public</span> <span class="type">interface</span> <span class="class">PartialBean</span>
+{
+    <span class="predefined-type">String</span> getValue();
+}
+
+<span class="annotation">@MyPartialBeanBinding</span>
+<span class="annotation">@Dependent</span>
+<span class="directive">public</span> <span class="type">class</span> <span class="class">MyPartialBeanHandler</span> <span class="directive">implements</span> java.lang.reflect.InvocationHandler
+{
+    <span class="directive">public</span> <span class="predefined-type">Object</span> invoke(<span class="predefined-type">Object</span> proxy, <span class="predefined-type">Method</span> method, <span class="predefined-type">Object</span><span class="type">[]</span> args) <span class="directive">throws</span> <span class="predefined-type">Throwable</span>
+    {
+        <span class="comment">//generic handler logic</span>
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Using an abstract class as partial-bean requires javassist as an
+additional dependency and allows to implement some methods manually.</p>
+</div>
+<div class="paragraph">
+<p>Attention: Currently CDI-Interceptors can&#8217;t be used for partial-beans.</p>
+</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: deltaspike/site/trunk/content/documentation/projectstage.html
URL: http://svn.apache.org/viewvc/deltaspike/site/trunk/content/documentation/projectstage.html?rev=1624296&view=auto
==============================================================================
--- deltaspike/site/trunk/content/documentation/projectstage.html (added)
+++ deltaspike/site/trunk/content/documentation/projectstage.html Thu Sep 11 14:16:37 2014
@@ -0,0 +1,334 @@
+<!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 ProjectStage</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 ProjectStage</h1>
+                </div>
+
+				<div id="toc" class="toc2">
+       	 		<ul class="sectlevel1">
+<li><a href="#_introduction">Introduction</a></li>
+<li>
+<ul class="sectlevel2">
+<li><a href="#_custom_project_stages">Custom Project Stages</a></li>
+<li><a href="#_projectstageproducer_for_3rd_party_portable_extensions">ProjectStageProducer (for 3rd party portable extensions)</a></li>
+<li>
+<ul class="sectlevel3">
+<li><a href="#_setting_the_active_projectstage">Setting the active ProjectStage</a></li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+       	 		<hr>	
+       	 		
+				<div class="sect1">
+<h2 id="_introduction">Introduction</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>Project stages allow to use implementations depending on the current
+environment. E.g. you can implement a bean which creates sample-data for
+system tests which gets activated only in case of project-stage
+<code>SystemTest</code>.</p>
+</div>
+<div class="paragraph">
+<p><em>Besides custom project-stages</em> it&#8217;s possible to use the following
+pre-defined project-stages:</p>
+</div>
+<div class="ulist">
+<ul>
+<li>
+<p>UnitTest</p>
+</li>
+<li>
+<p>Development</p>
+</li>
+<li>
+<p>SystemTest</p>
+</li>
+<li>
+<p>IntegrationTest</p>
+</li>
+<li>
+<p>Staging</p>
+</li>
+<li>
+<p>Production</p>
+</li>
+</ul>
+</div>
+<div class="paragraph">
+<p>The core provides a pluggable and type-safe approach for using project
+stages in a project (it&#8217;s also used within the framework). Furthermore,
+<code>@Exclude</code> allows to use e.g. i mplementations annotated with
+<code>javax.enterprise.inject.Alternative</code> for specific project-stages.
+Besides the out-of-the-box project-stages it&#8217;s possible to implement
+<em>custom but type-safe</em> project-stages which will be exposed by
+DeltaSpike.</p>
+</div>
+<div class="paragraph">
+<p>Resolving and using the Project-Stage:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@Inject</span>
+<span class="directive">private</span> ProjectStage projectStage;
+
+<span class="comment">//...</span>
+
+<span class="type">boolean</span> isDevProjectStage = ProjectStage.Development.equals(<span class="local-variable">this</span>.projectStage);</code></pre>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_custom_project_stages">Custom Project Stages</h3>
+<div class="paragraph">
+<p>It&#8217;s possible to provide custom project stage implementations.
+Therefore, you have to provide an implementation of the
+<code>ProjectStageHolder</code> interface. In this class you nest the custom
+project-stage implementations which have to be
+<code>public static final class</code> and it&#8217;s required to extend <code>ProjectStage</code>.
+It&#8217;s required to provide a <code>public static final</code> instance even though,
+you won&#8217;t use it directly.</p>
+</div>
+<div class="paragraph">
+<p>ProjectStageHolder for custom project stage implementations:</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">CustomProjectStageHolder</span> <span class="directive">implements</span> ProjectStageHolder
+{
+    <span class="directive">public</span> <span class="directive">static</span> <span class="directive">final</span> <span class="type">class</span> <span class="class">CustomProjectStage</span> <span class="directive">extends</span> ProjectStage
+    {
+        <span class="directive">private</span> <span class="directive">static</span> <span class="directive">final</span> <span class="type">long</span> serialVersionUID = <span class="integer">1029094387976167179L</span>;
+    }
+
+    <span class="directive">public</span> <span class="directive">static</span> <span class="directive">final</span> CustomProjectStage CustomProjectStage = <span class="keyword">new</span> CustomProjectStage();
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Configure your custom <code>ProjectStageHolder</code> in
+<code>META-INF/services/org.apache.deltaspike.core.api.projectstage.ProjectStageHolder</code>.
+The file has to provide the <em>fully qualified</em> class name of the custom
+implementation of the <code>ProjectStageHolder</code> interface.</p>
+</div>
+<div class="paragraph">
+<p>Usage of a custom project stage:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java">ProjectStage customProjectStage;
+customProjectStage = ProjectStage.valueOf(<span class="string"><span class="delimiter">&quot;</span><span class="content">CustomProjectStage</span><span class="delimiter">&quot;</span></span>);
+<span class="comment">//or</span>
+customProjectStage = CustomProjectStageHolder.CustomProjectStage;
+<span class="comment">//or</span>
+<span class="annotation">@Exclude</span>(ifProjectStage = CustomProjectStageHolder.CustomProjectStage.class)</code></pre>
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_projectstageproducer_for_3rd_party_portable_extensions">ProjectStageProducer (for 3rd party portable extensions)</h3>
+<div class="paragraph">
+<p><code>ProjectStageProducer</code> provides the producer method which allows to
+inject the current project-stage. However, in some cases it&#8217;s needed to
+use project-stages also during the bootstrapping process of the CDI
+container and you can&#8217;t use injection. In such cases you can use
+<code>ProjectStageProducer.getInstance().getProjectStage()</code> to resolve the
+current project-stage. This helper also contains helpers for unit-tests
+- e.g. <code>#setProjectStage</code>. However, those methods shouldn&#8217;t be needed
+for users (we just need them for testing different project-stage
+scenarios).</p>
+</div>
+<div class="sect3">
+<h4 id="_setting_the_active_projectstage">Setting the active ProjectStage</h4>
+<div class="paragraph">
+<p>For setting the ProjectStage which shall get used in your application
+you can specify it in a few ways. The underlying mechanism used to
+determine the string is the ConfigResolver. E.g.:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre>-Dorg.apache.deltaspike.ProjectStage=Development</pre>
+</div>
+</div>
+</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: deltaspike/site/trunk/content/documentation/scheduler.html
URL: http://svn.apache.org/viewvc/deltaspike/site/trunk/content/documentation/scheduler.html?rev=1624296&view=auto
==============================================================================
--- deltaspike/site/trunk/content/documentation/scheduler.html (added)
+++ deltaspike/site/trunk/content/documentation/scheduler.html Thu Sep 11 14:16:37 2014
@@ -0,0 +1,360 @@
+<!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>Title: Scheduler 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>Title: Scheduler Module</h1>
+                </div>
+
+				<div id="toc" class="toc2">
+       	 		<ul class="sectlevel1">
+<li><a href="#_intro">Intro</a></li>
+<li><a href="#_external_dependencies">External Dependencies</a></li>
+<li><a href="#__scheduled">@Scheduled</a></li>
+<li><a href="#_manual_scheduler_control">Manual Scheduler Control</a></li>
+<li><a href="#_custom_scheduler">Custom Scheduler</a></li>
+</ul>
+       	 		<hr>	
+       	 		
+				<div class="sect1">
+<h2 id="_intro">Intro</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>This module provides a simple integration with Quartz v2 (per default)
+or any other scheduler which supports cron-expressions for job-classes.</p>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_external_dependencies">External Dependencies</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>If you would like to use the default-integration with quartz (which is
+optional), you have to add quartz 2.x.</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.quartz-scheduler<span class="tag">&lt;/groupId&gt;</span>
+    <span class="tag">&lt;artifactId&gt;</span>quartz<span class="tag">&lt;/artifactId&gt;</span>
+    <span class="tag">&lt;version&gt;</span>2.2.1<span class="tag">&lt;/version&gt;</span>
+<span class="tag">&lt;/dependency&gt;</span></code></pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="__scheduled">@Scheduled</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>Just annotate your Quartz-Jobs with <code>@Scheduled</code> and they will get
+picked up and passed to the scheduler automatically (during the
+bootstrapping process).</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@Scheduled</span>(cronExpression = <span class="string"><span class="delimiter">&quot;</span><span class="content">0 0/10 * * * ?</span><span class="delimiter">&quot;</span></span>)
+<span class="directive">public</span> <span class="type">class</span> <span class="class">CdiAwareQuartzJob</span> <span class="directive">implements</span> org.quartz.Job
+{
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> MyService service;
+
+    <span class="annotation">@Override</span>
+    <span class="directive">public</span> <span class="type">void</span> execute(JobExecutionContext context) <span class="directive">throws</span> JobExecutionException
+    {
+        <span class="comment">//...</span>
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>In such Quartz-jobs CDI based dependency-injection is enabled.
+Furthermore, the request- and session-scope get started (and stopped)
+per job-execution. Therefore, the container-control module (of
+DeltaSpike) is required. That can be controlled via
+<code>@Scheduled#startScopes</code> (possible values: all scopes supported by the
+container-control module as well as <code>{}</code> for <em>no scopes</em>).</p>
+</div>
+<div class="paragraph">
+<p>With <em>false</em> for <code>@Scheduled#onStartup</code> it&#8217;s even possible to
+schedule/install jobs dynamically - e.g.:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@ApplicationScoped</span>
+<span class="directive">public</span> <span class="type">class</span> <span class="class">ProjectStageAwareSchedulerController</span>
+{
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> Scheduler&lt;Job&gt; jobScheduler;
+
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> ProjectStage projectStage;
+
+    <span class="directive">public</span> <span class="type">void</span> registerJobs()
+    {
+        <span class="keyword">if</span> (ProjectStage.Production.equals(<span class="local-variable">this</span>.projectStage))
+        {
+            <span class="comment">//see 'false' for @Scheduled#onStartup</span>
+            <span class="local-variable">this</span>.jobScheduler.scheduleJob(ManualCdiAwareQuartzJob.class);
+        }
+    }
+
+    <span class="annotation">@Scheduled</span>(cronExpression = <span class="string"><span class="delimiter">&quot;</span><span class="content">0 0/10 * * * ?</span><span class="delimiter">&quot;</span></span>, onStartup = <span class="predefined-constant">false</span>)
+    <span class="directive">public</span> <span class="type">class</span> <span class="class">ManualCdiAwareQuartzJob</span> <span class="directive">implements</span> org.quartz.Job
+    {
+        <span class="annotation">@Inject</span>
+        <span class="directive">private</span> MyService service;
+
+        <span class="annotation">@Override</span>
+        <span class="directive">public</span> <span class="type">void</span> execute(JobExecutionContext context) <span class="directive">throws</span> JobExecutionException
+        {
+            <span class="comment">//...</span>
+        }
+    }
+}</code></pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_manual_scheduler_control">Manual Scheduler Control</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>This SPI allows to control the scheduler (or integrate any other
+compatible scheduler as an alternative to Quartz2)</p>
+</div>
+<div class="paragraph">
+<p>Via std. injection like</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@Inject</span>
+<span class="directive">private</span> Scheduler&lt;Job&gt; jobScheduler;</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>it&#8217;s possible to manually start/stop the scheduler,
+pause/resume/interrupt/check scheduled jobs, register jobs manually or
+start a job once (without registering it permanently).</p>
+</div>
+<div class="paragraph">
+<p><strong>Attention</strong>:</p>
+</div>
+<div class="paragraph">
+<p>With some versions of Weld you have to use</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">QuartzSchedulerProducer</span>
+{
+    <span class="annotation">@Produces</span>
+    <span class="annotation">@ApplicationScoped</span>
+    <span class="directive">protected</span> Scheduler&lt;Job&gt; produceScheduler(Scheduler scheduler)
+    {
+        <span class="keyword">return</span> scheduler;
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>or</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="xml language-xml"><span class="tag">&lt;alternatives&gt;</span>
+  <span class="tag">&lt;class&gt;</span>org.apache.deltaspike.scheduler.impl.QuartzSchedulerProducer<span class="tag">&lt;/class&gt;</span>
+<span class="tag">&lt;/alternatives&gt;</span></code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>to use a typed injection-point. Otherwise the deployment will fail.</p>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_custom_scheduler">Custom Scheduler</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>It&#8217;s possible to replace the default integration with Quartz. Any other
+scheduler which supports cron-expressions for job-classes can be used.
+Please have a look at <code>org.apache.deltaspike.test.scheduler.custom</code> for
+further details.</p>
+</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: deltaspike/site/trunk/content/documentation/security.html
URL: http://svn.apache.org/viewvc/deltaspike/site/trunk/content/documentation/security.html?rev=1624296&view=auto
==============================================================================
--- deltaspike/site/trunk/content/documentation/security.html (added)
+++ deltaspike/site/trunk/content/documentation/security.html Thu Sep 11 14:16:37 2014
@@ -0,0 +1,818 @@
+<!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 Security 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>DeltaSpike Security Module</h1>
+                </div>
+
+				<div id="toc" class="toc2">
+       	 		<ul class="sectlevel1">
+<li><a href="#_hint">Hint</a></li>
+<li><a href="#_securitybinding_for_class_and_method_invocations">SecurityBinding for class and method invocations</a></li>
+<li><a href="#_integrating_3rd_party_security_frameworks">Integrating 3rd party security frameworks</a></li>
+<li>
+<ul class="sectlevel2">
+<li><a href="#__secured">@Secured</a></li>
+<li><a href="#_accessdecisionvoter">AccessDecisionVoter</a></li>
+<li><a href="#_securityviolation">SecurityViolation</a></li>
+<li><a href="#_abstractaccessdecisionvoter">AbstractAccessDecisionVoter</a></li>
+<li><a href="#__secured_and_stereotypes_with_custom_meta_data">@Secured and Stereotypes with custom Meta-data</a></li>
+</ul>
+</li>
+<li><a href="#_making_intitially_requested_and_secured_page_available_for_redirect_after_login">Making intitially requested and secured page available for redirect after login</a></li>
+<li>
+<ul class="sectlevel2">
+<li><a href="#_cdi_implementation_to_redirect_the_login_to_the_first_denied_page">CDI Implementation to redirect the login to the first denied page</a></li>
+<li><a href="#_picketlink_implementation_to_redirect_the_login_to_the_first_denied_page">PicketLink Implementation to redirect the login to the first denied page</a></li>
+</ul>
+</li>
+<li><a href="#_accessdecisionvotercontext">AccessDecisionVoterContext</a></li>
+<li>
+<ul class="sectlevel2">
+<li><a href="#_securitystrategy_spi">SecurityStrategy SPI</a></li>
+</ul>
+</li>
+</ul>
+       	 		<hr>	
+       	 		
+				<div class="sect1">
+<h2 id="_hint">Hint</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>If you are using features described by this page and the CDI
+container you are using is Weld (or OpenWebBeans in BDA mode), you have
+to enable the security interceptor in your beans.xml file:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="xml language-xml"><span class="tag">&lt;beans&gt;</span>
+    <span class="tag">&lt;interceptors&gt;</span>
+        <span class="tag">&lt;class&gt;</span>org.apache.deltaspike.security.impl.extension.SecurityInterceptor<span class="tag">&lt;/class&gt;</span>
+    <span class="tag">&lt;/interceptors&gt;</span>
+<span class="tag">&lt;/beans&gt;</span></code></pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_securitybinding_for_class_and_method_invocations">SecurityBinding for class and method invocations</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>This feature of the security module functions by intercepting method
+calls, and performing a security check before invocation is allowed to
+proceed.</p>
+</div>
+<div class="paragraph">
+<p>In order to use the DeltaSpike security module, you must first have
+installed the proper dependencies into your POM file. Once this is
+complete, you may proceed to create a security parameter binding
+annotation. This is what we will use to add security behavior to our
+business classes and methods.</p>
+</div>
+<div class="paragraph">
+<p>Create the SecurityBinding:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@Retention</span>(value = RUNTIME)
+<span class="annotation">@Target</span>({TYPE, METHOD})
+<span class="annotation">@Documented</span>
+<span class="annotation">@SecurityBindingType</span>
+<span class="directive">public</span> <span class="annotation">@interface</span> CustomSecurityBinding {
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Next, we must define an Authorizer class to implement behavior for our
+custom SecurityBindingType. This class is simply a CDI bean which
+declares a @Secures method, qualified with the security binding
+annotation we created in the first step.</p>
+</div>
+<div class="paragraph">
+<p>This method has access to the InvocationContext of the method call, so
+if we need to access parameter arguments, we can do so using the given
+context. Note that we may also inject other beans into the parameter
+list of our @Secures method.</p>
+</div>
+<div class="paragraph">
+<p>Create the Authorizer:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@ApplicationScoped</span>
+<span class="directive">public</span> <span class="type">class</span> <span class="class">CustomAuthorizer</span>
+{
+    <span class="annotation">@Secures</span>
+    <span class="annotation">@CustomSecurityBinding</span>
+    <span class="directive">public</span> <span class="type">boolean</span> doSecuredCheck(InvocationContext invocationContext, BeanManager manager, <span class="annotation">@LoggedIn</span> User user) <span class="directive">throws</span> <span class="exception">Exception</span>
+    {
+        <span class="keyword">return</span> user.isLoggedIn(); <span class="comment">// perform security check</span>
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>We can then use our new annotation to secure business or bean methods.
+This binding annotation may be placed on the entire class (securing all
+methods,) or on individual methods that you wish to secure.</p>
+</div>
+<div class="paragraph">
+<p>Secure a bean method:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@ApplicationScoped</span>
+<span class="directive">public</span> <span class="type">class</span> <span class="class">SecuredBean1</span>
+{
+    <span class="annotation">@CustomSecurityBinding</span>
+    <span class="directive">public</span> <span class="type">void</span> doSomething(Thing thing)
+    {
+        thing.doSomething();
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Next, we may access parameter values from the method invocation directly
+in our authorizer bean by creating custom @SecurityParameterBinding
+types; this is a simple step once we have completed the work above:</p>
+</div>
+<div class="paragraph">
+<p>Create a parameter binding annotation:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@Retention</span>(value = RUNTIME)
+<span class="annotation">@Target</span>({PARAMETER})
+<span class="annotation">@Documented</span>
+<span class="annotation">@SecurityParameterBinding</span>
+<span class="directive">public</span> <span class="annotation">@interface</span> CurrentThing {
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Now, when a secured method is invoked, we can inject actual parameter
+values as arguments into our authorizer method, providing domain-level
+security in our applications:</p>
+</div>
+<div class="paragraph">
+<p>Update the Authorizer to use parameter binding:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@ApplicationScoped</span>
+<span class="directive">public</span> <span class="type">class</span> <span class="class">CustomAuthorizer</span>
+{
+    <span class="annotation">@Secures</span>
+    <span class="annotation">@CustomSecurityBinding</span>
+    <span class="directive">public</span> <span class="type">boolean</span> doSecuredCheck(InvocationContext invocationContext, BeanManager manager, <span class="annotation">@LoggedIn</span> User user, <span class="annotation">@CurrentThing</span> Thing thing) <span class="directive">throws</span> <span class="exception">Exception</span>
+    {
+        <span class="keyword">return</span> thing.hasMember(user); <span class="comment">// perform security check against our method parameter</span>
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Note that our business method must also be annotated.</p>
+</div>
+<div class="paragraph">
+<p>Complete the parameter binding:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@ApplicationScoped</span>
+<span class="directive">public</span> <span class="type">class</span> <span class="class">SecuredBean1</span>
+{
+    <span class="annotation">@CustomSecurityBinding</span>
+    <span class="directive">public</span> <span class="type">void</span> doSomething(<span class="annotation">@CurrentThing</span> Thing thing)
+    {
+        thing.doSomething();
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Our method is now secured, and we are able to use given parameter values
+as part of our security authorizer!</p>
+</div>
+<div class="paragraph">
+<p>There may be cases where you may want to base your authorization logic
+on the result of the secured method and do the security check after the
+method invocation. Just use the same security binding type for that
+case:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@ApplicationScoped</span>
+<span class="directive">public</span> <span class="type">class</span> <span class="class">SecuredBean1</span>
+{
+    <span class="annotation">@CustomSecurityBinding</span>
+    <span class="directive">public</span> Thing loadSomething()
+    {
+        <span class="keyword">return</span> thingLoader.load();
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Now you need to access the return value in the authorizer method. You
+can inject it using the @SecuredReturn annotation. Update the Authorizer
+to use a secured return value:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@ApplicationScoped</span>
+<span class="directive">public</span> <span class="type">class</span> <span class="class">CustomAuthorizer</span>
+{
+    <span class="annotation">@Secures</span>
+    <span class="annotation">@CustomSecurityBinding</span>
+    <span class="directive">public</span> <span class="type">boolean</span> doSecuredCheck(<span class="annotation">@SecuredReturn</span> Thing thing, <span class="annotation">@LoggedIn</span> User user) <span class="directive">throws</span> <span class="exception">Exception</span>
+    {
+        <span class="keyword">return</span> thing.hasMember(user); <span class="comment">// perform security check against the return value</span>
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Now the authorization will take place after the method invocation using
+the return value of the business method.</p>
+</div>
+<div class="paragraph">
+<p>Complete the parameter binding:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@ApplicationScoped</span>
+<span class="directive">public</span> <span class="type">class</span> <span class="class">SecuredBean1</span>
+{
+    <span class="annotation">@CustomSecurityBinding</span>
+    <span class="directive">public</span> <span class="type">void</span> doSomething(<span class="annotation">@CurrentThing</span> Thing thing)
+    {
+        thing.doSomething();
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Our method is now secured, and we are able to use given parameter values
+as part of our security authorizer!</p>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_integrating_3rd_party_security_frameworks">Integrating 3rd party security frameworks</h2>
+<div class="sectionbody">
+<div class="sect2">
+<h3 id="__secured">@Secured</h3>
+<div class="paragraph">
+<p><code>@Secured</code> is build on <code>@SecurityBindingType</code> and a very simple
+alternative to the rest of the security module. It&#8217;s a basic hook to
+integrate a custom security concept, 3rd party frameworks,&#8230; . It
+doesn&#8217;t provide a full blown security concept like the rest of the
+security module, but other DeltaSpike modules ensure that the security
+concepts are integrated properly (e.g. correct behaviour within custom
+scope implementations,&#8230;). It just allows to integrate other security
+frameworks easily.</p>
+</div>
+<div class="paragraph">
+<p>(In MyFaces CODI it was originally a CDI interceptor. This part changed
+a bit, because between the interceptor and <code>@Secured</code> is the
+<code>@SecurityBindingType</code> concept which triggers <code>@Secured</code> as on possible
+approach. Therefore the basic behaviour remains the same and you can
+think about it like an interceptor.)</p>
+</div>
+<div class="paragraph">
+<p>Securing all intercepted methods of a CDI bean:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="comment">//...</span>
+<span class="annotation">@Secured</span>(CustomAccessDecisionVoter.class)
+<span class="directive">public</span> <span class="type">class</span> <span class="class">SecuredBean</span>
+{
+    <span class="comment">//...</span>
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>or</p>
+</div>
+<div class="paragraph">
+<p>Securing specific methods:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="comment">//...</span>
+<span class="directive">public</span> <span class="type">class</span> <span class="class">SecuredBean</span>
+{
+    <span class="annotation">@Secured</span>(CustomAccessDecisionVoter.class)
+    <span class="directive">public</span> <span class="predefined-type">String</span> getResult()
+    {
+        <span class="comment">//...</span>
+    }
+}</code></pre>
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_accessdecisionvoter">AccessDecisionVoter</h3>
+<div class="paragraph">
+<p>This interface is (besides the <code>Secured</code> annotation) the most important
+part of the concept. Both artifact types are also the only required
+parts:</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">CustomAccessDecisionVoter</span> <span class="directive">implements</span> AccessDecisionVoter
+{
+    <span class="annotation">@Override</span>
+    <span class="directive">public</span> <span class="predefined-type">Set</span>&lt;SecurityViolation&gt; checkPermission(AccessDecisionVoterContext accessDecisionVoterContext)
+    {
+        <span class="predefined-type">Method</span> method = accessDecisionVoterContext.&lt;InvocationContext&gt;getSource().getMethod();
+
+        <span class="comment">//...</span>
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>[TODO] hint about the changed parameter/s</p>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_securityviolation">SecurityViolation</h3>
+<div class="paragraph">
+<p>In case of a detected violation a <code>SecurityViolation</code> has to be added to
+the result returned by the <code>AccessDecisionVoter</code>.</p>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_abstractaccessdecisionvoter">AbstractAccessDecisionVoter</h3>
+<div class="paragraph">
+<p>You can also implement the abstract class <code>AbstractAccessDecisionVoter</code>.
+This is a convenience class which allows an easier usage:</p>
+</div>
+<div class="paragraph">
+<p>Example: :::java public class CustomAccessDecisionVoter extends
+AbstractAccessDecisionVoter \{</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java">    <span class="annotation">@Override</span>
+    <span class="directive">protected</span> <span class="type">void</span> checkPermission(AccessDecisionVoterContext accessDecisionVoterContext,
+            <span class="predefined-type">Set</span>&lt;SecurityViolation&gt; violations)
+    {
+        <span class="comment">// check for violations</span>
+        violations.add(newSecurityViolation(<span class="string"><span class="delimiter">&quot;</span><span class="content">access not allowed due to ...</span><span class="delimiter">&quot;</span></span>));
+    }
+}</code></pre>
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 id="__secured_and_stereotypes_with_custom_meta_data">@Secured and Stereotypes with custom Meta-data</h3>
+<div class="paragraph">
+<p>If there are multiple <code>AccessDecisionVoter</code> and maybe in different
+constellations, it&#8217;s easier to provide an expressive CDI stereotypes for
+it. Later on that also allows to change the behaviour in a central
+place.</p>
+</div>
+<div class="paragraph">
+<p>Stereotype support of @Secured:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@Named</span>
+<span class="annotation">@Admin</span>
+<span class="directive">public</span> <span class="type">class</span> <span class="class">MyBean</span> <span class="directive">implements</span> <span class="predefined-type">Serializable</span>
+{
+  <span class="comment">//...</span>
+}
+
+<span class="comment">//...</span>
+<span class="annotation">@Stereotype</span>
+<span class="annotation">@Secured</span>(RoleAccessDecisionVoter.class)
+<span class="directive">public</span> <span class="annotation">@interface</span> Admin
+{
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Furthermore, it&#8217;s possible to provide custom meta-data easily.</p>
+</div>
+<div class="paragraph">
+<p>Stereotype of @Secured with custom meta-data:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@Named</span>
+<span class="annotation">@Admin</span>(securityLevel=<span class="integer">3</span>)
+<span class="directive">public</span> <span class="type">class</span> <span class="class">MyBean</span> <span class="directive">implements</span> <span class="predefined-type">Serializable</span>
+{
+  <span class="comment">//...</span>
+}
+
+<span class="comment">//...</span>
+<span class="annotation">@Stereotype</span>
+<span class="annotation">@Secured</span>(RoleAccessDecisionVoter.class)
+<span class="directive">public</span> <span class="annotation">@interface</span> Admin
+{
+  <span class="type">int</span> securityLevel();
+}
+
+<span class="annotation">@ApplicationScoped</span>
+<span class="directive">public</span> <span class="type">class</span> <span class="class">RoleAccessDecisionVoter</span> <span class="directive">implements</span> AccessDecisionVoter
+{
+    <span class="directive">private</span> <span class="directive">static</span> <span class="directive">final</span> <span class="type">long</span> serialVersionUID = -<span class="integer">8007511215776345835L</span>;
+
+    <span class="directive">public</span> <span class="predefined-type">Set</span>&lt;SecurityViolation&gt; checkPermission(AccessDecisionVoterContext voterContext)
+    {
+        Admin admin = voterContext.getMetaDataFor(Admin.class.getName(), Admin.class);
+        <span class="type">int</span> level = admin.securityLevel();
+        <span class="comment">//...</span>
+    }
+}</code></pre>
+</div>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_making_intitially_requested_and_secured_page_available_for_redirect_after_login">Making intitially requested and secured page available for redirect after login</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>DeltaSpike can be combined with pure CDI or with any other security
+frameworks (like PicketLink) to track the denied page and make it
+available after user logs in.</p>
+</div>
+<div class="sect2">
+<h3 id="_cdi_implementation_to_redirect_the_login_to_the_first_denied_page">CDI Implementation to redirect the login to the first denied page</h3>
+<div class="paragraph">
+<p>Your LoginService will fire a custom <code>UserLoggedInEvent</code></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">LoginService</span> <span class="directive">implements</span> <span class="predefined-type">Serializable</span> {
+
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> <span class="predefined-type">Event</span>&lt;UserLoggedInEvent&gt; userLoggedInEvent;
+
+    <span class="directive">public</span> Usuario login(<span class="predefined-type">String</span> username, <span class="type">char</span><span class="type">[]</span> password) {
+        <span class="comment">//do the loggin process</span>
+        userLoggedInEvent.fire(<span class="keyword">new</span> UserLoggedInEvent());
+    }
+
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Use @SessionScoped or @WindowScoped for AdminAccessDecisionVoter and
+store the denied page on your own.</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@SessionScoped</span> <span class="comment">//or @WindowScoped</span>
+<span class="directive">public</span> <span class="type">class</span> <span class="class">AdminAccessDecisionVoter</span> <span class="directive">extends</span> AbstractAccessDecisionVoter {
+
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> ViewConfigResolver viewConfigResolver;
+
+    <span class="directive">private</span> <span class="predefined-type">Class</span>&lt;? <span class="directive">extends</span> ViewConfig&gt; deniedPage = Pages.Home.class;
+
+    <span class="annotation">@Override</span>
+    <span class="directive">protected</span> <span class="type">void</span> checkPermission(AccessDecisionVoterContext context, <span class="predefined-type">Set</span>&lt;SecurityViolation&gt; violations) {
+        <span class="keyword">if</span>(loggedIn) {
+            <span class="comment">//...</span>
+        } <span class="keyword">else</span> {
+            violations.add(<span class="comment">/*...*/</span>);
+            deniedPage = viewConfigResolver.getViewConfigDescriptor(FacesContext.getCurrentInstance().getViewRoot().getViewId()).getConfigClass();
+        }
+    }
+
+    <span class="directive">public</span> <span class="predefined-type">Class</span>&lt;? <span class="directive">extends</span> ViewConfig&gt; getDeniedPage() {
+        <span class="keyword">try</span> {
+            <span class="keyword">return</span> deniedPage;
+        } <span class="keyword">finally</span> {
+            deniedPage = Pages.Home.class;
+        }
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>And in AuthenticationListener you inject AdminAccessDecisionVoter</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">AuthenticationListener</span> {
+
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> ViewNavigationHandler viewNavigationHandler;
+
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> AdminAccessDecisionVoter adminAccessDecisionVoter;
+
+    <span class="directive">public</span> <span class="type">void</span> handleLoggedIn(<span class="annotation">@Observes</span> UserLoggedInEvent event) {
+        <span class="local-variable">this</span>.viewNavigationHandler.navigateTo(adminAccessDecisionVoter.getDeniedPage());
+    }
+
+}</code></pre>
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_picketlink_implementation_to_redirect_the_login_to_the_first_denied_page">PicketLink Implementation to redirect the login to the first denied page</h3>
+<div class="paragraph">
+<p>Once that PicketLink handles the authentication for you, you only need
+to store the denied page and observe PicketLink <code>LoggedInEvent</code> to
+redirect you back to the denied page.</p>
+</div>
+<div class="paragraph">
+<p>Use @SessionScoped or @WindowScoped for AdminAccessDecisionVoter and
+store the denied page on your own.</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay"><code class="java language-java"><span class="annotation">@SessionScoped</span> <span class="comment">//or @WindowScoped</span>
+<span class="directive">public</span> <span class="type">class</span> <span class="class">AdminAccessDecisionVoter</span> <span class="directive">extends</span> AbstractAccessDecisionVoter {
+
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> ViewConfigResolver viewConfigResolver;
+
+    <span class="directive">private</span> <span class="predefined-type">Class</span>&lt;? <span class="directive">extends</span> ViewConfig&gt; deniedPage = Pages.Home.class;
+
+    <span class="annotation">@Override</span>
+    <span class="directive">protected</span> <span class="type">void</span> checkPermission(AccessDecisionVoterContext context, <span class="predefined-type">Set</span>&lt;SecurityViolation&gt; violations) {
+
+        AuthorizationChecker authorizationChecker = BeanProvider.getContextualReference(AuthorizationChecker.class);
+        <span class="type">boolean</span> loggedIn = authorizationChecker.isLoggedIn();
+
+        <span class="keyword">if</span>(loggedIn) {
+            <span class="comment">//...</span>
+        } <span class="keyword">else</span> {
+            violations.add(<span class="comment">/*...*/</span>);
+            deniedPage = viewConfigResolver.getViewConfigDescriptor(FacesContext.getCurrentInstance().getViewRoot().getViewId()).getConfigClass();
+        }
+    }
+
+    <span class="directive">public</span> <span class="predefined-type">Class</span>&lt;? <span class="directive">extends</span> ViewConfig&gt; getDeniedPage() {
+        <span class="keyword">try</span> {
+            <span class="keyword">return</span> deniedPage;
+        } <span class="keyword">finally</span> {
+            deniedPage = Pages.Home.class;
+        }
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>And in AuthenticationListener you inject AdminAccessDecisionVoter</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">AuthenticationListener</span> {
+
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> ViewNavigationHandler viewNavigationHandler;
+
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> AdminAccessDecisionVoter adminAccessDecisionVoter;
+
+    <span class="directive">public</span> <span class="type">void</span> handleLoggedIn(<span class="annotation">@Observes</span> LoggedInEvent event) {
+        <span class="local-variable">this</span>.viewNavigationHandler.navigateTo(adminAccessDecisionVoter.getDeniedPage());
+    }
+
+}</code></pre>
+</div>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_accessdecisionvotercontext">AccessDecisionVoterContext</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>Because the <code>AccessDecisionVoter</code> can be chained,
+<code>AccessDecisionVoterContext</code> allows to get the current state as well as
+the results of the security check.</p>
+</div>
+<div class="paragraph">
+<p>There are several methods that can be useful</p>
+</div>
+<div class="ulist">
+<ul>
+<li>
+<p><code>getState()</code> - Exposes the current state : INITIAL, VOTE_IN_PROGRESS, VIOLATION_FOUND, NO_VIOLATION_FOUND</p>
+</li>
+<li>
+<p><code>getViolations()</code> - Exposes the found violations</p>
+</li>
+<li>
+<p><code>getSource()</code> - Exposes e.g. the current instance of <code>javax.interceptor.InvocationContext</code> in combination with <code>@Secured</code> used as interceptor.</p>
+</li>
+<li>
+<p><code>getMetaData()</code> - Exposes the found meta-data e.g. the view-config-class if <code>@Secured</code> is used in combination with type-safe view-configs</p>
+</li>
+<li>
+<p><code>getMetaDataFor(String, Class&lt;T&gt;)</code> - Exposes meta-data for the given key</p>
+</li>
+</ul>
+</div>
+<div class="sect2">
+<h3 id="_securitystrategy_spi">SecurityStrategy SPI</h3>
+<div class="paragraph">
+<p>The <code>SecurityStrategy</code> interface allows to provide a custom
+implementation which should be used for <code>@Secured</code>. Provide a custom
+implementation as bean-class in combination with <code>@Alternative</code> or
+<code>@Specializes</code> (or as global-alternative).</p>
+</div>
+<div class="paragraph">
+<p>In case of global-alternatives an additional config needs to be added to
+<code>/META-INF/apache-deltaspike.properties</code> - e.g.:</p>
+</div>
+<div class="paragraph">
+<p><code>globalAlternatives.org.apache.deltaspike.security.spi.authorization.SecurityStrategy=mypackage.CustomSecurityStrategy</code></p>
+</div>
+<div class="paragraph">
+<p><strong>Note</strong>: The config for global-alternatives is following the pattern:
+globalAlternatives.<code>&lt;interface-name&gt;</code>=<code>&lt;implementation-class-name&gt;</code></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



Mime
View raw message