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>). 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 <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>). 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>  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 <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 <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  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[</instructions>
...
<Import-Package>
@@ -140,7 +140,23 @@ feature:install cxf/3.1.0 cxf-jaxrs-cdi/
 <Web-ContextPath>...</Web-ContextPath>
<_wab>src/main/webapp</_wab>
</instructions>]]></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  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  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,  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[<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <servlet>
+ <servlet-name>CXFServlet</servlet-name>
+ <display-name>CXF Servlet</display-name>
+
<servlet-class>org.apache.cxf.cdi.CXFCdiServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>CXFServlet</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+</web-app>]]></script>
+</div></div></div>
</div>
<!-- Content -->
</td>