deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r918732 - in /websites/staging/deltaspike/trunk/content: ./ container-control.html
Date Fri, 08 Aug 2014 14:26:56 GMT
Author: buildbot
Date: Fri Aug  8 14:26:56 2014
New Revision: 918732

Log:
Staging update by buildbot for deltaspike

Modified:
    websites/staging/deltaspike/trunk/content/   (props changed)
    websites/staging/deltaspike/trunk/content/container-control.html

Propchange: websites/staging/deltaspike/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Fri Aug  8 14:26:56 2014
@@ -1 +1 @@
-1616774
+1616778

Modified: websites/staging/deltaspike/trunk/content/container-control.html
==============================================================================
--- websites/staging/deltaspike/trunk/content/container-control.html (original)
+++ websites/staging/deltaspike/trunk/content/container-control.html Fri Aug  8 14:26:56 2014
@@ -97,17 +97,17 @@
 <h1 id="introduction">Introduction</h1>
 <p>There are basically two parts:</p>
 <ul>
-<li>The <strong>CdiContainer</strong> interface allows to boot and shutdown
the CDI container in SE applications.</li>
-<li>The <strong>ContextControl</strong> interface allows to control the
life-cycle of the built-in contexts of the CDI container.</li>
+<li>The <code>CdiContainer</code> interface allows to boot and shutdown
the CDI container in SE applications.</li>
+<li>The <code>ContextControl</code> interface allows to control the life-cycle
of the built-in contexts of the CDI container.</li>
 </ul>
 <h2 id="cdicontainer">CdiContainer</h2>
-<p>You can use the CdiContainerLoader as a simple factory to gain access to the underlying
CdiContainer implementation. This is of little interest for Java EE applications since the
CDI Container 
+<p>You can use the <code>CdiContainerLoader</code> as a simple factory
to gain access to the underlying <code>CdiContainer</code> implementation. This
is of little interest for Java EE applications since the CDI Container
 already gets properly booted and shut down by the Servlet container integration.</p>
 <div class="codehilite"><pre><span class="c1">// this will give you a CdiContainer
for Weld or OWB, depending on the jar you added</span>
 <span class="n">CdiContainer</span> <span class="n">cdiContainer</span>
<span class="o">=</span> <span class="n">CdiContainerLoader</span><span
class="o">.</span><span class="na">getCdiContainer</span><span class="o">();</span>
 
 <span class="c1">// now we gonna boot the CDI container. This will trigger the classpath
scan, etc</span>
-   <span class="n">cdiContainer</span><span class="o">.</span><span
class="na">boot</span><span class="o">();</span>
+<span class="n">cdiContainer</span><span class="o">.</span><span
class="na">boot</span><span class="o">();</span>
 
 <span class="c1">// and finally we like to start all built-in contexts</span>
 <span class="n">cdiContainer</span><span class="o">.</span><span
class="na">getContextControl</span><span class="o">().</span><span
class="na">startContexts</span><span class="o">();</span>
@@ -184,49 +184,49 @@ You might face such issues, if you would
 
 <h3 id="jetty">Jetty</h3>
 <p>For Jetty, you need to add an <code>EventListener</code> which will
be your <code>CdiServletRequestListener</code>.  The object must be instantiated.
 This must be done before the server is started.</p>
-<div class="codehilite"><pre>    <span class="n">Server</span> <span
class="n">server</span> <span class="o">=</span> <span class="k">new</span>
<span class="n">Server</span><span class="o">(</span><span class="n">port</span><span
class="o">);</span>
-    <span class="n">ServletContextHandler</span> <span class="n">context</span>
<span class="o">=</span> <span class="k">new</span> <span class="n">ServletContextHandler</span><span
class="o">(</span><span class="n">ServletContextHandler</span><span
class="o">.</span><span class="na">SESSIONS</span><span class="o">);</span>
-    <span class="n">context</span><span class="o">.</span><span
class="na">setContextPath</span><span class="o">(</span><span class="s">&quot;/&quot;</span><span
class="o">);</span>
-    <span class="n">server</span><span class="o">.</span><span
class="na">setHandler</span><span class="o">(</span><span class="n">context</span><span
class="o">);</span>
+<div class="codehilite"><pre><span class="n">Server</span> <span
class="n">server</span> <span class="o">=</span> <span class="k">new</span>
<span class="n">Server</span><span class="o">(</span><span class="n">port</span><span
class="o">);</span>
+<span class="n">ServletContextHandler</span> <span class="n">context</span>
<span class="o">=</span> <span class="k">new</span> <span class="n">ServletContextHandler</span><span
class="o">(</span><span class="n">ServletContextHandler</span><span
class="o">.</span><span class="na">SESSIONS</span><span class="o">);</span>
+<span class="n">context</span><span class="o">.</span><span class="na">setContextPath</span><span
class="o">(</span><span class="s">&quot;/&quot;</span><span
class="o">);</span>
+<span class="n">server</span><span class="o">.</span><span class="na">setHandler</span><span
class="o">(</span><span class="n">context</span><span class="o">);</span>
 
-    <span class="n">context</span><span class="o">.</span><span
class="na">addEventListener</span><span class="o">(</span><span class="k">new</span>
<span class="n">CdiServletRequestListener</span><span class="o">());</span>
-    <span class="n">context</span><span class="o">.</span><span
class="na">addServlet</span><span class="o">(</span><span class="k">new</span>
<span class="n">ServletHolder</span><span class="o">(</span><span
class="k">new</span> <span class="n">YourServlet</span><span class="o">()),</span><span
class="s">&quot;/*&quot;</span><span class="o">);</span>
+<span class="n">context</span><span class="o">.</span><span class="na">addEventListener</span><span
class="o">(</span><span class="k">new</span> <span class="n">CdiServletRequestListener</span><span
class="o">());</span>
+<span class="n">context</span><span class="o">.</span><span class="na">addServlet</span><span
class="o">(</span><span class="k">new</span> <span class="n">ServletHolder</span><span
class="o">(</span><span class="k">new</span> <span class="n">YourServlet</span><span
class="o">()),</span><span class="s">&quot;/*&quot;</span><span
class="o">);</span>
 
-    <span class="n">server</span><span class="o">.</span><span
class="na">start</span><span class="o">();</span>
+<span class="n">server</span><span class="o">.</span><span class="na">start</span><span
class="o">();</span>
 </pre></div>
 
 
 <h3 id="undertow">Undertow</h3>
 <p>For Undertow, you register the <code>CdiServletRequestListener</code>
via <code>ListenerInfo</code> by passing in the class to their builders.  Then
you add the <code>ListenerInfo</code> to your deployment before starting.</p>
-<div class="codehilite"><pre>    <span class="n">ServletInfo</span>
<span class="n">servletInfo</span> <span class="o">=</span> <span
class="n">Servlets</span><span class="o">.</span><span class="na">servlet</span><span
class="o">(</span><span class="s">&quot;RequestServlet&quot;</span><span
class="o">,</span> <span class="n">YourServlet</span><span class="o">.</span><span
class="na">class</span><span class="o">).</span><span class="na">setAsyncSupported</span><span
class="o">(</span><span class="kc">true</span><span class="o">)</span>
-        <span class="o">.</span><span class="na">setLoadOnStartup</span><span
class="o">(</span><span class="mi">1</span><span class="o">).</span><span
class="na">addMapping</span><span class="o">(</span><span class="s">&quot;/*&quot;</span><span
class="o">);</span>
-    <span class="n">ListenerInfo</span> <span class="n">listenerInfo</span>
<span class="o">=</span> <span class="n">Servlets</span><span class="o">.</span><span
class="na">listener</span><span class="o">(</span><span class="n">CdiServletRequestListener</span><span
class="o">.</span><span class="na">class</span><span class="o">);</span>
-    <span class="n">DeploymentInfo</span> <span class="n">di</span>
<span class="o">=</span> <span class="k">new</span> <span class="n">DeploymentInfo</span><span
class="o">()</span>
-            <span class="o">.</span><span class="na">addListener</span><span
class="o">(</span><span class="n">listenerInfo</span><span class="o">)</span>
-            <span class="o">.</span><span class="na">setContextPath</span><span
class="o">(</span><span class="s">&quot;/&quot;</span><span
class="o">)</span>
-            <span class="o">.</span><span class="na">addServlet</span><span
class="o">(</span><span class="n">servletInfo</span><span class="o">).</span><span
class="na">setDeploymentName</span><span class="o">(</span><span class="s">&quot;CdiSEServlet&quot;</span><span
class="o">)</span>
-            <span class="o">.</span><span class="na">setClassLoader</span><span
class="o">(</span><span class="n">ClassLoader</span><span class="o">.</span><span
class="na">getSystemClassLoader</span><span class="o">());</span>
-    <span class="n">DeploymentManager</span> <span class="n">deploymentManager</span>
<span class="o">=</span> <span class="n">Servlets</span><span class="o">.</span><span
class="na">defaultContainer</span><span class="o">().</span><span
class="na">addDeployment</span><span class="o">(</span><span class="n">di</span><span
class="o">);</span>
-    <span class="n">deploymentManager</span><span class="o">.</span><span
class="na">deploy</span><span class="o">();</span>
-    <span class="n">Undertow</span> <span class="n">server</span>
<span class="o">=</span> <span class="n">Undertow</span><span class="o">.</span><span
class="na">builder</span><span class="o">()</span>
-            <span class="o">.</span><span class="na">addHttpListener</span><span
class="o">(</span><span class="n">port</span><span class="o">,</span>
<span class="s">&quot;localhost&quot;</span><span class="o">)</span>
-            <span class="o">.</span><span class="na">setHandler</span><span
class="o">(</span><span class="n">deploymentManager</span><span class="o">.</span><span
class="na">start</span><span class="o">())</span>
-            <span class="o">.</span><span class="na">build</span><span
class="o">();</span>
-    <span class="n">server</span><span class="o">.</span><span
class="na">start</span><span class="o">();</span>
+<div class="codehilite"><pre><span class="n">ServletInfo</span> <span
class="n">servletInfo</span> <span class="o">=</span> <span class="n">Servlets</span><span
class="o">.</span><span class="na">servlet</span><span class="o">(</span><span
class="s">&quot;RequestServlet&quot;</span><span class="o">,</span>
<span class="n">YourServlet</span><span class="o">.</span><span
class="na">class</span><span class="o">).</span><span class="na">setAsyncSupported</span><span
class="o">(</span><span class="kc">true</span><span class="o">)</span>
+    <span class="o">.</span><span class="na">setLoadOnStartup</span><span
class="o">(</span><span class="mi">1</span><span class="o">).</span><span
class="na">addMapping</span><span class="o">(</span><span class="s">&quot;/*&quot;</span><span
class="o">);</span>
+<span class="n">ListenerInfo</span> <span class="n">listenerInfo</span>
<span class="o">=</span> <span class="n">Servlets</span><span class="o">.</span><span
class="na">listener</span><span class="o">(</span><span class="n">CdiServletRequestListener</span><span
class="o">.</span><span class="na">class</span><span class="o">);</span>
+<span class="n">DeploymentInfo</span> <span class="n">di</span> <span
class="o">=</span> <span class="k">new</span> <span class="n">DeploymentInfo</span><span
class="o">()</span>
+        <span class="o">.</span><span class="na">addListener</span><span
class="o">(</span><span class="n">listenerInfo</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">setContextPath</span><span
class="o">(</span><span class="s">&quot;/&quot;</span><span
class="o">)</span>
+        <span class="o">.</span><span class="na">addServlet</span><span
class="o">(</span><span class="n">servletInfo</span><span class="o">).</span><span
class="na">setDeploymentName</span><span class="o">(</span><span class="s">&quot;CdiSEServlet&quot;</span><span
class="o">)</span>
+        <span class="o">.</span><span class="na">setClassLoader</span><span
class="o">(</span><span class="n">ClassLoader</span><span class="o">.</span><span
class="na">getSystemClassLoader</span><span class="o">());</span>
+<span class="n">DeploymentManager</span> <span class="n">deploymentManager</span>
<span class="o">=</span> <span class="n">Servlets</span><span class="o">.</span><span
class="na">defaultContainer</span><span class="o">().</span><span
class="na">addDeployment</span><span class="o">(</span><span class="n">di</span><span
class="o">);</span>
+<span class="n">deploymentManager</span><span class="o">.</span><span
class="na">deploy</span><span class="o">();</span>
+<span class="n">Undertow</span> <span class="n">server</span> <span
class="o">=</span> <span class="n">Undertow</span><span class="o">.</span><span
class="na">builder</span><span class="o">()</span>
+        <span class="o">.</span><span class="na">addHttpListener</span><span
class="o">(</span><span class="n">port</span><span class="o">,</span>
<span class="s">&quot;localhost&quot;</span><span class="o">)</span>
+        <span class="o">.</span><span class="na">setHandler</span><span
class="o">(</span><span class="n">deploymentManager</span><span class="o">.</span><span
class="na">start</span><span class="o">())</span>
+        <span class="o">.</span><span class="na">build</span><span
class="o">();</span>
+<span class="n">server</span><span class="o">.</span><span class="na">start</span><span
class="o">();</span>
 </pre></div>
 
 
 <h3 id="tomcat">Tomcat</h3>
 <p>For Tomcat, you need to register the <code>CdiServletContextListener</code>
instead of the <code>CdiServletRequestListener</code>.  It is added as an <code>ApplicationListener</code>
by passing in the class name as a <code>String</code>.</p>
-<div class="codehilite"><pre>    <span class="n">Tomcat</span> <span
class="n">tomcat</span> <span class="o">=</span> <span class="k">new</span>
<span class="n">Tomcat</span><span class="o">();</span>
-    <span class="n">tomcat</span><span class="o">.</span><span
class="na">setPort</span><span class="o">(</span><span class="n">port</span><span
class="o">);</span>
-    <span class="n">File</span> <span class="n">base</span> <span
class="o">=</span> <span class="k">new</span> <span class="n">File</span><span
class="o">(</span><span class="s">&quot;...&quot;</span><span
class="o">);</span>
-    <span class="n">Context</span> <span class="n">ctx</span> <span
class="o">=</span> <span class="n">tomcat</span><span class="o">.</span><span
class="na">addContext</span><span class="o">(</span><span class="s">&quot;/&quot;</span><span
class="o">,</span><span class="n">base</span><span class="o">.</span><span
class="na">getAbsolutePath</span><span class="o">());</span>
-    <span class="n">StandardContext</span> <span class="n">standardContext</span>
<span class="o">=</span> <span class="o">(</span><span class="n">StandardContext</span><span
class="o">)</span><span class="n">ctx</span><span class="o">;</span>
-    <span class="n">standardContext</span><span class="o">.</span><span
class="na">addApplicationListener</span><span class="o">(</span><span
class="n">CdiServletContextListener</span><span class="o">.</span><span
class="na">class</span><span class="o">.</span><span class="na">getName</span><span
class="o">());</span>
-    <span class="n">Wrapper</span> <span class="n">wrapper</span>
<span class="o">=</span> <span class="n">Tomcat</span><span class="o">.</span><span
class="na">addServlet</span><span class="o">(</span><span class="n">ctx</span><span
class="o">,</span><span class="s">&quot;YourServlet&quot;</span><span
class="o">,</span><span class="n">YourServlet</span><span class="o">.</span><span
class="na">class</span><span class="o">.</span><span class="na">getName</span><span
class="o">());</span>
-    <span class="n">wrapper</span><span class="o">.</span><span
class="na">addMapping</span><span class="o">(</span><span class="s">&quot;/*&quot;</span><span
class="o">);</span>
-    <span class="n">tomcat</span><span class="o">.</span><span
class="na">start</span><span class="o">();</span>
+<div class="codehilite"><pre><span class="n">Tomcat</span> <span
class="n">tomcat</span> <span class="o">=</span> <span class="k">new</span>
<span class="n">Tomcat</span><span class="o">();</span>
+<span class="n">tomcat</span><span class="o">.</span><span class="na">setPort</span><span
class="o">(</span><span class="n">port</span><span class="o">);</span>
+<span class="n">File</span> <span class="n">base</span> <span
class="o">=</span> <span class="k">new</span> <span class="n">File</span><span
class="o">(</span><span class="s">&quot;...&quot;</span><span
class="o">);</span>
+<span class="n">Context</span> <span class="n">ctx</span> <span
class="o">=</span> <span class="n">tomcat</span><span class="o">.</span><span
class="na">addContext</span><span class="o">(</span><span class="s">&quot;/&quot;</span><span
class="o">,</span><span class="n">base</span><span class="o">.</span><span
class="na">getAbsolutePath</span><span class="o">());</span>
+<span class="n">StandardContext</span> <span class="n">standardContext</span>
<span class="o">=</span> <span class="o">(</span><span class="n">StandardContext</span><span
class="o">)</span><span class="n">ctx</span><span class="o">;</span>
+<span class="n">standardContext</span><span class="o">.</span><span
class="na">addApplicationListener</span><span class="o">(</span><span
class="n">CdiServletContextListener</span><span class="o">.</span><span
class="na">class</span><span class="o">.</span><span class="na">getName</span><span
class="o">());</span>
+<span class="n">Wrapper</span> <span class="n">wrapper</span> <span
class="o">=</span> <span class="n">Tomcat</span><span class="o">.</span><span
class="na">addServlet</span><span class="o">(</span><span class="n">ctx</span><span
class="o">,</span><span class="s">&quot;YourServlet&quot;</span><span
class="o">,</span><span class="n">YourServlet</span><span class="o">.</span><span
class="na">class</span><span class="o">.</span><span class="na">getName</span><span
class="o">());</span>
+<span class="n">wrapper</span><span class="o">.</span><span class="na">addMapping</span><span
class="o">(</span><span class="s">&quot;/*&quot;</span><span
class="o">);</span>
+<span class="n">tomcat</span><span class="o">.</span><span class="na">start</span><span
class="o">();</span>
 </pre></div>
           </div>
       </div>



Mime
View raw message