cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Kulp (Confluence)" <conflue...@apache.org>
Subject [CONF] Apache CXF Documentation > Bus Configuration
Date Thu, 12 Dec 2013 18:50:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/en/2176/1/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/~dkulp">Daniel
Kulp</a>
    </h4>
        <br/>
                         <h4>Changes (1)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <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 <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">[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>
<span class="diff-added-words"style="background-color: #dfd;">http://cxf.apache.org/schemas/core.xsd.</span>
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>
    
            </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="theme: Default; brush: xml; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
&lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:cxf="http://cxf.apache.org/core"
      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;

    &lt;bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/&gt;

    &lt;cxf:bus&gt;
        &lt;cxf:outInterceptors&gt;
            &lt;ref bean="logOutbound"/&gt;
        &lt;/cxf:outInterceptors&gt;
    &lt;/cxf:bus&gt; 
&lt;/beans&gt;
</pre>
</div></div>

<p>The configurable properties of the bus are defined in the bus configuration schema
<a href="http://cxf.apache.org/schemas/core.xsd" 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'>properties</td>
<td class='confluenceTd'>Contextual properties which will be applied to all endpoints
and clients using this bus</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="theme: Default; brush: java; gutter: false" style="font-size:12px; font-family:
ConfluenceInstalledFont,monospace;">
import javax.xml.ws.Endpoint;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.EndpointImpl;

Object implementor = new GreeterImpl();
EndpointImpl ep = (EndpointImpl) Endpoint.publish("http://localhost/service", implementor);

ep.getServiceFactory().getBus().getInInterceptors().add(new LoggingInInterceptor());
ep.getServiceFactory().getBus().getOutInterceptors().add(new 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;" class="grey">
                        <a href="https://cwiki.apache.org/confluence/users/removespacenotification.action?spaceKey=CXF20DOC">Stop
watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://cwiki.apache.org/confluence/users/editmyemailsettings.action">Change
email 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=11&originalVersion=10">View
Changes</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message