cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache CXF Documentation > Bus Configuration
Date Fri, 11 Jan 2013 10:15:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/1/_/styles/combined.css?spaceKey=CXF20DOC&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CXF20DOC/Bus+Configuration">Bus
Configuration</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~coheigea@apache.org">Colm
O hEigeartaigh</a>
    </h4>
        <br/>
                         <h4>Changes (6)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-unchanged" >h1. Configuring the Bus <br>
<br></td></tr>
            <tr><td class="diff-changed-lines" >The Bus is the backbone of <span
class="diff-added-words"style="background-color: #dfd;">the</span> CXF architecture.
It manages extensions and acts as an interceptor provider. The interceptors for the bus will
be added to the respective inbound and outbound message and fault interceptor chains for all
client and server endpoints created on the bus (in its context).  By default, it contributes
no interceptors to either of these interceptor chain types, but they can be added via configuration
files or with Java code, as shown below. <br></td></tr>
            <tr><td class="diff-unchanged" > <br>Note: For endpoint-specific
configuration (as opposed to configuration for *all* for endpoints created by the CXF bus),
look at the [Logging Messages|Debugging and Logging] section for code samples. <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >h3. Using a Configuration File <br>
<br></td></tr>
            <tr><td class="diff-changed-lines" >Here, simply define a bus element
in your Spring configuration file, and add child elements as <span class="diff-changed-words">required,<span
class="diff-added-chars"style="background-color: #dfd;"> </span>for</span>
example: <br></td></tr>
            <tr><td class="diff-unchanged" > <br>{code:xml} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >The configurable properties of
the bus are defined in the bus configuration schema [http://cxf.apache.org/schemas/core.xsd|http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/resources/schemas/core.xsd?view=markup].
<span class="diff-added-words"style="background-color: #dfd;">Be sure to include the
namespace - URI pair for this schema in the schemaLocation attribute of the &lt;beans&gt;
element.</span> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">Be
sure to include the namespace - URI pair for this schema in the schemaLocation attribute of
the &lt;beans&gt; element. <br></td></tr>
            <tr><td class="diff-unchanged" > <br>The &lt;bus&gt;
element supports the following child elements: <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >h3. Configuration using Java code
<br> <br></td></tr>
            <tr><td class="diff-changed-lines" >Although usually less convenient,
interceptors can be added to the bus using Java code.  Given an [EndpointImpl|http://cxf.apache.org/javadoc/latest/org/apache/cxf/jaxws/EndpointImpl.html]
object, the <span class="diff-added-words"style="background-color: #dfd;">bus can be
accessed (and interceptors added) as follows:</span> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">bus
can be accessed (and interceptors added) as follows: <br></td></tr>
            <tr><td class="diff-unchanged" > <br>{code} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="BusConfiguration-ConfiguringtheBus"></a>Configuring
the Bus</h1>

<p>The Bus is the backbone of the CXF architecture. It manages extensions and acts as
an interceptor provider. The interceptors for the bus will be added to the respective inbound
and outbound message and fault interceptor chains for all client and server endpoints created
on the bus (in its context).  By default, it contributes no interceptors to either of these
interceptor chain types, but they can be added via configuration files or with Java code,
as shown below.</p>

<p>Note: For endpoint-specific configuration (as opposed to configuration for <b>all</b>
for endpoints created by the CXF bus), look at the <a href="/confluence/display/CXF20DOC/Debugging+and+Logging"
title="Debugging and Logging">Logging Messages</a> section for code samples.</p>

<h3><a name="BusConfiguration-UsingaConfigurationFile"></a>Using a Configuration
File</h3>

<p>Here, simply define a bus element in your Spring configuration file, and add child
elements as required, for example:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
&lt;beans xmlns=<span class="code-quote">"http://www.springframework.org/schema/beans"</span>
      <span class="code-keyword">xmlns:xsi</span>=<span class="code-quote">"http://www.w3.org/2001/XMLSchema-instance"</span>
      <span class="code-keyword">xmlns:cxf</span>=<span class="code-quote">"http://cxf.apache.org/core"</span>
      xsi:schemaLocation="
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"&gt;

    <span class="code-tag">&lt;bean id=<span class="code-quote">"logOutbound"</span>
class=<span class="code-quote">"org.apache.cxf.interceptor.LoggingOutInterceptor"</span>/&gt;</span>

    <span class="code-tag">&lt;cxf:bus&gt;</span>
        <span class="code-tag">&lt;cxf:outInterceptors&gt;</span>
            <span class="code-tag">&lt;ref bean=<span class="code-quote">"logOutbound"</span>/&gt;</span>
        <span class="code-tag">&lt;/cxf:outInterceptors&gt;</span>
    <span class="code-tag">&lt;/cxf:bus&gt;</span> 
<span class="code-tag">&lt;/beans&gt;</span>
</pre>
</div></div>

<p>The configurable properties of the bus are defined in the bus configuration schema
<a href="http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/resources/schemas/core.xsd?view=markup"
class="external-link" rel="nofollow">http://cxf.apache.org/schemas/core.xsd</a>.
Be sure to include the namespace - URI pair for this schema in the schemaLocation attribute
of the &lt;beans&gt; element.</p>

<p>The &lt;bus&gt; element supports the following child elements:</p>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Name</th>
<th class='confluenceTh'>Value</th>
</tr>
<tr>
<td class='confluenceTd'>inInterceptors</td>
<td class='confluenceTd'>The interceptors contributed to inbound message interceptor
chains. A list of &lt;bean&gt;s or &lt;ref&gt;s.</td>
</tr>
<tr>
<td class='confluenceTd'>inFaultInterceptors</td>
<td class='confluenceTd'>The interceptors contributed to inbound fault interceptor chains.
 A list of &lt;bean&gt;s or &lt;ref&gt;s.</td>
</tr>
<tr>
<td class='confluenceTd'>outInterceptors</td>
<td class='confluenceTd'>The interceptors contributed to outbound message interceptor
chains. A list of &lt;bean&gt;s or &lt;ref&gt;s.</td>
</tr>
<tr>
<td class='confluenceTd'>outFaultInterceptors</td>
<td class='confluenceTd'>The interceptors contributed to outbound fault interceptor
chains. A list of &lt;bean&gt;s or &lt;ref&gt;s.</td>
</tr>
<tr>
<td class='confluenceTd'>features</td>
<td class='confluenceTd'>The features applied to the bus. A list of &lt;bean&gt;s
or &lt;ref&gt;s. See <a href="/confluence/display/CXF20DOC/FeaturesList" title="FeaturesList">here</a>
for a list of available features.</td>
</tr>
</tbody></table>
</div>


<h3><a name="BusConfiguration-ConfigurationusingJavacode"></a>Configuration
using Java code</h3>

<p>Although usually less convenient, interceptors can be added to the bus using Java
code.  Given an <a href="http://cxf.apache.org/javadoc/latest/org/apache/cxf/jaxws/EndpointImpl.html"
class="external-link" rel="nofollow">EndpointImpl</a> object, the bus can be accessed
(and interceptors added) as follows:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
<span class="code-keyword">import</span> javax.xml.ws.Endpoint;
<span class="code-keyword">import</span> org.apache.cxf.interceptor.LoggingInInterceptor;
<span class="code-keyword">import</span> org.apache.cxf.interceptor.LoggingOutInterceptor;
<span class="code-keyword">import</span> org.apache.cxf.jaxws.EndpointImpl;

<span class="code-object">Object</span> implementor = <span class="code-keyword">new</span>
GreeterImpl();
EndpointImpl ep = (EndpointImpl) Endpoint.publish(<span class="code-quote">"http:<span
class="code-comment">//localhost/service"</span>, implementor);
</span>
ep.getServiceFactory().getBus().getInInterceptors().add(<span class="code-keyword">new</span>
LoggingInInterceptor());
ep.getServiceFactory().getBus().getOutInterceptors().add(<span class="code-keyword">new</span>
LoggingOutInterceptor());
</pre>
</div></div>

<h1><a name="BusConfiguration-ExtendingtheBus"></a>Extending the Bus</h1>

<p>TODO: Explain how to add a custom bus extension (META-INF/cxf/cxf.extension ...).</p>

    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/Bus+Configuration">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=62558&revisedVersion=9&originalVersion=8">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/Bus+Configuration?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message