You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bu...@apache.org on 2015/04/05 17:46:56 UTC

svn commit: r946406 - in /websites/production/cxf/content: cache/docs.pageCache docs/using-cxf-and-cdi-1112-jsr-346-in-osgi-environment.html

Author: buildbot
Date: Sun Apr  5 15:46:56 2015
New Revision: 946406

Log:
Production update by buildbot for cxf

Modified:
    websites/production/cxf/content/cache/docs.pageCache
    websites/production/cxf/content/docs/using-cxf-and-cdi-1112-jsr-346-in-osgi-environment.html

Modified: websites/production/cxf/content/cache/docs.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/cxf/content/docs/using-cxf-and-cdi-1112-jsr-346-in-osgi-environment.html
==============================================================================
--- websites/production/cxf/content/docs/using-cxf-and-cdi-1112-jsr-346-in-osgi-environment.html (original)
+++ websites/production/cxf/content/docs/using-cxf-and-cdi-1112-jsr-346-in-osgi-environment.html Sun Apr  5 15:46:56 2015
@@ -116,14 +116,14 @@ Apache CXF -- Using CXF and CDI 1.1/1.2
          <td height="100%">
            <!-- Content -->
            <div class="wiki-content">
-<div id="ConfluenceContent"><h1 id="UsingCXFandCDI1.1/1.2(JSR-346)inOSGienvironment-Introduction">Introduction</h1><p>Since 3.1.0 release, Apache CXF supports CDI-based deployment inside OSGi container which uses Pax CDI (Contexts and Dependency Injection for OSGi) implementation (<a shape="rect" class="external-link" href="https://github.com/ops4j/org.ops4j.pax.cdi" rel="nofollow">https://github.com/ops4j/org.ops4j.pax.cdi</a>).&#160;Apache CXF provides the <strong>cxf-jaxrs-cdi</strong> feature (for easy deployment into OSGi containers such as <strong>Apache Karaf</strong>) as well as <strong>cxf-integration-cdi</strong> module includes necessary OSGi bundle metadata to be used by Pax CDI.</p><h1 id="UsingCXFandCDI1.1/1.2(JSR-346)inOSGienvironment-Installation">Installation</h1><p>For the installation steps, <strong>Apache Karaf 3.0.3</strong> OSGi container is going to be used as it is the most widely used OSGi container. All commands shown below are intended to be executed from 
 Apache Karaf shell. The first step is to install <strong>http</strong> and Pax CDI features, which is CDI-version dependent.</p><p>For CDI 1.1, please use&#160;<strong>pax-cdi-1.1-web-weld</strong> feature:</p><div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
+<div id="ConfluenceContent"><h1 id="UsingCXFandCDI1.1/1.2(JSR-346)inOSGienvironment-Introduction">Introduction</h1><p>Since 3.1.0 release, Apache CXF supports CDI-based deployment inside OSGi container which uses Pax CDI (Contexts and Dependency Injection for OSGi) implementation (<a shape="rect" class="external-link" href="https://github.com/ops4j/org.ops4j.pax.cdi" rel="nofollow">https://github.com/ops4j/org.ops4j.pax.cdi</a>).&#160;Apache CXF provides the <strong>cxf-jaxrs-cdi</strong> feature (for easy deployment into OSGi containers such as <strong>Apache Karaf</strong>) as well as <strong>cxf-integration-cdi</strong> module, which includes necessary OSGi bundle metadata to be used by Pax CDI.</p><h1 id="UsingCXFandCDI1.1/1.2(JSR-346)inOSGienvironment-Installation">Installation</h1><p>For the installation steps, <strong>Apache Karaf 3.0.3</strong>&#160; is going to be used as it is the most widely used OSGi container. All commands shown below are intended to be executed from Ap
 ache Karaf shell. The first step is to install <strong>http</strong> and Pax CDI features, which is CDI-version dependent.</p><p>For CDI 1.1, please use&#160;<strong>pax-cdi-1.1-web-weld</strong> feature:</p><div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
 <pre>feature:install http pax-cdi-1.1-web-weld</pre>
 </div></div><p>For CDI 1.2, please use&#160;<strong>pax-cdi-1.2-web-weld</strong> feature:</p><div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
 <pre>feature:install http pax-cdi-1.2-web-weld</pre>
 </div></div><p>Next, Apache CXF 3.1.0+ features should be installed:</p><div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent panelContent">
 <pre>feature:repo-add cxf 3.1.0
 feature:install cxf/3.1.0 cxf-jaxrs-cdi/3.1.0</pre>
-</div></div><h1 id="UsingCXFandCDI1.1/1.2(JSR-346)inOSGienvironment-BundleMetadata">Bundle Metadata</h1><p>In order for the bundle to be recognized as web CDI one and use Apache CXF, it should provide special bundle manifest instructions (f.e. using <strong>maven-bundle-plugin</strong> plugin).</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h1 id="UsingCXFandCDI1.1/1.2(JSR-346)inOSGienvironment-BundleMetadata">Bundle Metadata</h1><p>In order for the bundle to be recognized as web CDI one and use Apache CXF CDI capabilities, it should provide special bundle manifest instructions (f.e.by&#160; using <strong>maven-bundle-plugin</strong> plugin).</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;/instructions&gt;
     ... 
     &lt;Import-Package&gt;
@@ -140,7 +140,23 @@ feature:install cxf/3.1.0 cxf-jaxrs-cdi/
     &lt;Web-ContextPath&gt;...&lt;/Web-ContextPath&gt;
     &lt;_wab&gt;src/main/webapp&lt;/_wab&gt;
 &lt;/instructions&gt;]]></script>
-</div></div><p>The <strong>Require-Capability</strong> instruction is very important in order for CDI initialization, discovery and injections to work with Apache CXF. The <strong>Web-ContextPath</strong> is the context path for this web application to be deployed at. And <strong>_wab</strong> is the instruction&#160; to point out the <strong>web.xml</strong> file location.</p></div>
+</div></div><p>The <strong>Require-Capability</strong> instruction is very important in order for CDI initialization, discovery and injections to work with Apache CXF. The <strong>Web-ContextPath</strong> is the context path for this web application to be deployed at. And <strong>_wab</strong> is the instruction&#160; to point out the <strong>web.xml</strong> file location. Please notice, the application will not be deployed under usual<strong> /cxf</strong> endpoint (common endpoint for regular Apache CXF services). The reason for that is that Pax Web is used for deployment of web CDI applications.</p><h1 id="UsingCXFandCDI1.1/1.2(JSR-346)inOSGienvironment-WebApplicationConfiguration">Web Application Configuration</h1><p>At the moment,&#160; Apache CXF OSGi application should explicitly provide <strong>web.xml</strong> descriptor with at least <strong>CXFCdiServlet </strong>defined. For example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panel
 Content pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;web-app version=&quot;3.0&quot; xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot;
+    xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
+
+    &lt;servlet&gt;
+        &lt;servlet-name&gt;CXFServlet&lt;/servlet-name&gt;
+        &lt;display-name&gt;CXF Servlet&lt;/display-name&gt;
+        &lt;servlet-class&gt;org.apache.cxf.cdi.CXFCdiServlet&lt;/servlet-class&gt;    
+        &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
+    &lt;/servlet&gt;
+
+    &lt;servlet-mapping&gt;
+        &lt;servlet-name&gt;CXFServlet&lt;/servlet-name&gt;
+        &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
+    &lt;/servlet-mapping&gt;
+&lt;/web-app&gt;]]></script>
+</div></div></div>
            </div>
            <!-- Content -->
          </td>