Author: buildbot
Date: Sun Apr 5 14:46:55 2015
New Revision: 946403
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 14:46:55 2015
@@ -28,6 +28,15 @@
<meta name="description" content="Apache CXF, Services Framework - Using CXF
and CDI 1.1/1.2 (JSR-346) in OSGi environment">
+<link type="text/css" rel="stylesheet"
href="/resources/highlighter/styles/shCoreCXF.css">
+<link type="text/css" rel="stylesheet"
href="/resources/highlighter/styles/shThemeCXF.css">
+
+<script src='/resources/highlighter/scripts/shCore.js'></script>
+<script src='/resources/highlighter/scripts/shBrushXml.js'></script>
+<script>
+ SyntaxHighlighter.defaults['toolbar'] = false;
+ SyntaxHighlighter.all();
+</script>
<title>
@@ -107,7 +116,31 @@ Apache CXF -- Using CXF and CDI 1.1/1.2
<td height="100%">
<!-- Content -->
<div class="wiki-content">
-<div id="ConfluenceContent"></div>
+<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">
+<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">
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[</instructions>
+ ...
+ <Import-Package>
+ javax.servlet;version="[2.6,4)",
+ org.apache.cxf.jaxrs;version="[3.1,4)",
+ org.apache.cxf.cdi;version="[3.1,4)",
+ *
+ </Import-Package>
+
+ <Require-Capability>
+ org.ops4j.pax.cdi.extension;
filter:="(&amp;(extension=cxf-integration-cdi))",
+ osgi.extender; filter:="(osgi.extender=pax.cdi)"
+ </Require-Capability>
+ Â <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>
<!-- Content -->
</td>