Author: buildbot
Date: Mon May 29 08:47:40 2017
New Revision: 1013084

Log:
Production update by buildbot for cxf

Modified:
    websites/production/cxf/content/cache/docs.pageCache
    websites/production/cxf/content/docs/interceptors.html

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

Modified: websites/production/cxf/content/docs/interceptors.html
==============================================================================
--- websites/production/cxf/content/docs/interceptors.html (original)
+++ websites/production/cxf/content/docs/interceptors.html Mon May 29 08:47:40 
2017
@@ -117,35 +117,8 @@ Apache CXF -- Interceptors
          <td height="100%">
            <!-- Content -->
            <div class="wiki-content">
-<div id="ConfluenceContent"><h1 
id="Interceptors-InterceptorsandPhases">Interceptors and Phases</h1>
-
-<p>Interceptors are the fundamental processing unit inside CXF. When a service 
is invoked, an InterceptorChain is created and invoked. Each interceptor gets a 
chance to do what they want with the message. This can include reading it, 
transforming it, processing headers, validating the message, etc.</p>
-
-<p>Interceptors are used with both CXF clients and CXF servers.  When a CXF 
client invokes a CXF server, there is an outgoing interceptor chain for the 
client and an incoming chain for the server.  When the server sends the 
response back to the client, there is an outgoing chain for the server and an 
incoming one for the client.  Additionally, in the case of <a shape="rect" 
class="external-link" 
href="http://java.sun.com/j2ee/1.4/docs/api/javax/xml/soap/SOAPFault.html"; 
rel="nofollow">SOAPFaults</a>, a CXF web service will create a separate 
outbound error handling chain and the client will create an inbound error 
handling chain.</p>
-
-<p>Some examples of interceptors inside CXF include:</p>
-<ul><li>SoapActionInterceptor - Processes the SOAPAction header and selects an 
operation if it's set.</li><li>StaxInInterceptor - Creates a Stax 
XMLStreamReader from the transport input 
stream.</li><li>Attachment(In/Out)Interceptor - Turns a multipart/related 
message into a series of attachments.</li></ul>
-
-
-<p>InterceptorChains are divided up into Phases. The phase that each 
interceptor runs in is declared in the interceptor's constructor.  Each phase 
may contain many interceptors. On the incoming chains, you'll have the 
following phases:</p>
-<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th 
colspan="1" rowspan="1" class="confluenceTh"><p> Phase </p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p> Functions </p></th></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p> RECEIVE </p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p> Transport level processing 
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> 
(PRE/USER/POST)_STREAM </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p> Stream level processing/transformations 
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> READ 
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> This is where 
header reading typically occurs. </p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p> (PRE/USER/POST)_PROTOCOL </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p> Protocol processing, such as JAX-WS SOAP 
handlers </p></td></tr><tr><td colspan="1" rowspan="
 1" class="confluenceTd"><p> UNMARSHAL </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p> Unmarshalling of the request </p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p> (PRE/USER/POST)_LOGICAL 
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Processing of the 
umarshalled request </p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p> PRE_INVOKE </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p> Pre invocation actions </p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p> INVOKE </p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p> Invocation of the service 
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> 
POST_INVOKE </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> 
Invocation of the outgoing chain if there is one 
</p></td></tr></tbody></table></div>
-
-<p>On the outgoing chain there are the following phases:</p>
-<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th 
colspan="1" rowspan="1" class="confluenceTh"><p> Phase </p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p> Functions </p></th></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p> SETUP </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p> Any set up for the following phases 
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> 
(PRE/USER/POST)_LOGICAL </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p> Processing of objects about to marshalled 
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> 
PREPARE_SEND </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> 
Opening of the connection </p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p> PRE_STREAM </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p> PRE_PROTOCOL </p></td><td colspan=
 "1" rowspan="1" class="confluenceTd"><p> Misc protocol actions. 
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> WRITE 
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Writing of the 
protocol message, such as the SOAP Envelope. </p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p> MARSHAL </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p> Marshalling of the objects 
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> 
(USER/POST)_PROTOCOL </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p> Processing of the protocol message. 
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> 
(USER/POST)_STREAM </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p> Processing of the byte level message 
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> SEND 
</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td></tr></tbody></table></div>
-
-
-<p>After the SEND phase, there are a bunch of "*_ENDING" phases that are 
symmetrical to the above phases to allow the interceptors to cleanup and close 
anything that they had opened or started in the above phases:</p>
-
-<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th 
colspan="1" rowspan="1" class="confluenceTh"><p> Phase </p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p> Functions </p></th></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p> SEND_ENDING </p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p> POST_STREAM_ENDING 
</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p> USER_STREAM_ENDING </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p> POST_PROTOCOL_ENDING </p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p> USER_PROTOCOL_ENDING 
</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td></tr><tr>
 <td colspan="1" rowspan="1" class="confluenceTd"><p> MARSHAL_ENDING 
</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p> WRITE_ENDING </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p> PRE_PROTOCOL_ENDING </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p> PRE_STREAM_ENDING </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p> PREPARE_SEND_ENDING </p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p> POST_LOGICAL_ENDING 
</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p> USER_LOGIC
 AL_ENDING </p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p> PRE_LOGICAL_ENDING </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p> SETUP_ENDING </p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p> Usually results in all the streams being 
closed and the final data being sent on the wire. 
</p></td></tr></tbody></table></div>
-
-
-
-<h1 id="Interceptors-InterceptorProviders">InterceptorProviders</h1>
-
-<p>Several different components inside CXF may provide interceptors to an 
InterceptorChain. These implement the InterceptorProvider interface:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">
-public interface InterceptorProvider {
+<div id="ConfluenceContent"><h1 
id="Interceptors-InterceptorsandPhases">Interceptors and 
Phases</h1><p>Interceptors are the fundamental processing unit inside CXF. When 
a service is invoked, an InterceptorChain is created and invoked. Each 
interceptor gets a chance to do what they want with the message. This can 
include reading it, transforming it, processing headers, validating the 
message, etc.</p><p>Interceptors are used with both CXF clients and CXF 
servers. When a CXF client invokes a CXF server, there is an outgoing 
interceptor chain for the client and an incoming chain for the server. When the 
server sends the response back to the client, there is an outgoing chain for 
the server and an incoming one for the client. Additionally, in the case of <a 
shape="rect" class="external-link" 
href="http://java.sun.com/j2ee/1.4/docs/api/javax/xml/soap/SOAPFault.html"; 
rel="nofollow">SOAPFaults</a>, a CXF web service will create a separate 
outbound error handling chain and the client will c
 reate an inbound error handling chain.</p><p>Some examples of interceptors 
inside CXF include:</p><ul><li>SoapActionInterceptor - Processes the SOAPAction 
header and selects an operation if it's set.</li><li>StaxInInterceptor - 
Creates a Stax XMLStreamReader from the transport input 
stream.</li><li>Attachment(In/Out)Interceptor - Turns a multipart/related 
message into a series of attachments.</li></ul><p>InterceptorChains are divided 
up into Phases. The phase that each interceptor runs in is declared in the 
interceptor's constructor. Each phase may contain many interceptors. On the 
incoming chains, you'll have the following phases:</p><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Phase</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Functions</p></th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>RECEIVE</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Transport level process
 ing</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>(PRE/USER/POST)_STREAM</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Stream level 
processing/transformations</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>READ</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>This is where header reading typically 
occurs.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>(PRE/USER/POST)_PROTOCOL</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Protocol processing, such as JAX-WS SOAP 
handlers</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>UNMARSHAL</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Unmarshalling of the request</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p>(PRE/USER/POST)_LOGICAL</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Processing of the umarshalled 
request</p></td></tr><tr><td colspan="1" rowspan="1" class="confl
 uenceTd"><p>PRE_INVOKE</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Pre invocation actions</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p>INVOKE</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Invocation of the service</p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p>POST_INVOKE</p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Invocation of the outgoing 
chain if there is one</p></td></tr></tbody></table></div><p>On the outgoing 
chain there are the following phases:</p><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Phase</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Functions</p></th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>SETUP</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Any set up for the following 
phases</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>(PRE/USER/
 POST)_LOGICAL</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Processing of objects about to 
marshalled</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>PREPARE_SEND</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Opening of the connection</p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p>PRE_STREAM</p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p>PRE_PROTOCOL</p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Misc protocol 
actions.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>WRITE</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Writing of the protocol message, such as the SOAP 
Envelope.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>MARSHAL</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Marshalling of the objects</p></td></tr><tr><td 
colspan="1" rowspan="
 1" class="confluenceTd"><p>(USER/POST)_PROTOCOL</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Processing of the protocol 
message.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>(USER/POST)_STREAM</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Processing of the byte level 
message</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>SEND</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td></tr></tbody></table></div><p>After the 
SEND phase, there are a bunch of "*_ENDING" phases that are symmetrical to the 
above phases to allow the interceptors to cleanup and close anything that they 
had opened or started in the above phases:</p><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Phase</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Functions</p></th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>SEND_ENDING<
 /p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>POST_STREAM_ENDING</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>USER_STREAM_ENDING</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>POST_PROTOCOL_ENDING</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p>USER_PROTOCOL_ENDING</p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p>MARSHAL_ENDING</p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p>WRITE_ENDING</p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></t
 d></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>PRE_PROTOCOL_ENDING</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>PRE_STREAM_ENDING</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>PREPARE_SEND_ENDING</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>POST_LOGICAL_ENDING</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>USER_LOGICAL_ENDING</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>PRE_LOGICAL_ENDING</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>S
 ETUP_ENDING</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Usually results in all the streams being closed and the 
final data being sent on the wire.</p></td></tr></tbody></table></div><h1 
id="Interceptors-InterceptorProviders">InterceptorProviders</h1><p>Several 
different components inside CXF may provide interceptors to an 
InterceptorChain. These implement the InterceptorProvider interface:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">public interface InterceptorProvider {
 
     List&lt;Interceptor&gt; getInInterceptors();
 
@@ -156,29 +129,12 @@ public interface InterceptorProvider {
     List&lt;Interceptor&gt; getInFaultInterceptors();
 }
 </pre>
-</div></div>
-<p>To add an interceptor to an interceptor chain, you'll want to add it to one 
of the Interceptor Providers.</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">
-MyInterceptor interceptor = new MyInterceptor();
+</div></div><p>To add an interceptor to an interceptor chain, you'll want to 
add it to one of the Interceptor Providers.</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">MyInterceptor interceptor = new MyInterceptor();
 provider.getInInterceptors().add(interceptor);
 </pre>
-</div></div>
-<p>Some InterceptorProviders inside CXF are:</p>
-<ul><li>Client</li><li>Endpoint</li><li>Service</li><li>Bus</li><li>Binding</li></ul>
-
-
-<h1 id="Interceptors-WritingandconfiguringanInterceptor">Writing and 
configuring an Interceptor</h1>
-
-<p>The CXF distribution is shipped with a demo called <a shape="rect" 
class="external-link" 
href="http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/configuration_interceptor/";>configuration_interceptor
 </a> which shows how to develop a user interceptor and configure the 
interceptor into its interceptor chain.</p>
-
-
-<h2 id="Interceptors-WritinganInterceptor">Writing an Interceptor</h2>
-
-<p>Writing an interceptor is relatively simple. Your interceptor needs to 
extend from either the AbstractPhaseInterceptor or one of its <a shape="rect" 
class="external-link" href="http://tinyurl.com/3bkho8"; rel="nofollow">many 
subclasses</a> such as AbstractSoapInterceptor. Extending from 
AbstractPhaseInterceptor allows your interceptor to access the methods of the 
<a shape="rect" class="external-link" href="http://tinyurl.com/24gj28"; 
rel="nofollow">Message</a> interface. For example, AttachmentInInterceptor is 
used in CXF to turn a multipart/related message into a series of attachments. 
It looks like below:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">
-import java.io.IOException;
+</div></div><p>Some InterceptorProviders inside CXF 
are:</p><ul><li>Client</li><li>Endpoint</li><li>Service</li><li>Bus</li><li>Binding</li></ul><h1
 id="Interceptors-WritingandconfiguringanInterceptor">Writing and configuring 
an Interceptor</h1><p>The CXF distribution is shipped with a demo called <a 
shape="rect" class="external-link" 
href="http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/configuration_interceptor/";>configuration_interceptor
 </a> which shows how to develop a user interceptor and configure the 
interceptor into its interceptor chain.</p><h2 
id="Interceptors-WritinganInterceptor">Writing an Interceptor</h2><p>Writing an 
interceptor is relatively simple. Your interceptor needs to extend from either 
the AbstractPhaseInterceptor or one of its <a shape="rect" 
class="external-link" href="http://tinyurl.com/3bkho8"; rel="nofollow">many 
subclasses</a> such as AbstractSoapInterceptor. Extending from 
AbstractPhaseInterceptor allows your interceptor to
  access the methods of the <a shape="rect" class="external-link" 
href="http://tinyurl.com/24gj28"; rel="nofollow">Message</a> interface. For 
example, AttachmentInInterceptor is used in CXF to turn a multipart/related 
message into a series of attachments. It looks like below:</p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">import java.io.IOException;
 
 import org.apache.cxf.attachment.AttachmentDeserializer;
 import org.apache.cxf.message.Message;
@@ -206,11 +162,8 @@ public class AttachmentInInterceptor ext
     }
 }
 </pre>
-</div></div>
-<p>Extending from sub-classes of AbstractPhaseInterceptor allows your 
interceptor to access more specific information than those in the Message 
interface. One of the sub-classes of AbstractPhaseInterceptor is <a 
shape="rect" class="external-link" href="http://tinyurl.com/2xqyg6"; 
rel="nofollow">AbstractSoapInterceptor</a>.  Extending from this class allows 
your interceptor to access the SOAP header and version information of the <a 
shape="rect" class="external-link" href="http://tinyurl.com/2gxj2c"; 
rel="nofollow">SoapMessage class</a>. For example, SoapActionInInterceptor is 
used in CXF to parse the SOAP action, as a simplified version of it shows 
below:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">
-import java.util.Collection;
+</div></div><p>Extending from sub-classes of AbstractPhaseInterceptor allows 
your interceptor to access more specific information than those in the Message 
interface. One of the sub-classes of AbstractPhaseInterceptor is <a 
shape="rect" class="external-link" href="http://tinyurl.com/2xqyg6"; 
rel="nofollow">AbstractSoapInterceptor</a>. Extending from this class allows 
your interceptor to access the SOAP header and version information of the <a 
shape="rect" class="external-link" href="http://tinyurl.com/2gxj2c"; 
rel="nofollow">SoapMessage class</a>. For example, SoapActionInInterceptor is 
used in CXF to parse the SOAP action, as a simplified version of it shows 
below:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
@@ -282,22 +235,16 @@ public class SoapActionInInterceptor ext
 
 }
 </pre>
-</div></div>
-<p>Note that you will need to specify the phase that the interceptor will be 
included in. This is done in the interceptor's constructor:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">
-public class MyInterceptor extends AbstractSoapInterceptor {
+</div></div><p>Note that you will need to specify the phase that the 
interceptor will be included in. This is done in the interceptor's 
constructor:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">public class MyInterceptor extends 
AbstractSoapInterceptor {
   public MyInterceptor() {
     super(Phase.USER_PROTOCOL);
   }
   ...
 }
 </pre>
-</div></div>
-<p>You can also express that you would like the interceptor to run 
before/after certain other interceptors defined in the same phase:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">
-public class MyInterceptor extends AbstractSoapInterceptor {
+</div></div><p>You can also express that you would like the interceptor to run 
before/after certain other interceptors defined in the same phase:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">public class MyInterceptor extends 
AbstractSoapInterceptor {
   public MyInterceptor() {
     super(Phase.USER_PROTOCOL);
 
@@ -310,15 +257,8 @@ public class MyInterceptor extends Abstr
   ...
 }
 </pre>
-</div></div>
-<p>You can add your interceptors into the interceptor chain either 
programmatically or through configuration.</p>
-
-<h2 id="Interceptors-Addinginterceptorsprogrammatically">Adding interceptors 
programmatically</h2>
-
-<p>To add this to your server, you'll want to get access to the Server object 
(see <a shape="rect" 
href="server-service-and-client-factorybeans.html">here</a> for more info):</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">
-import org.apache.cxf.endpoint.Server;
+</div></div><p>You can add your interceptors into the interceptor chain either 
programmatically or through configuration.</p><h2 
id="Interceptors-Addinginterceptorsprogrammatically">Adding interceptors 
programmatically</h2><p>To add this to your server, you'll want to get access 
to the Server object (see <a shape="rect" 
href="server-service-and-client-factorybeans.html">here</a> for more 
info):</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.frontend.ServerFactoryBean;
 ...
 
@@ -327,12 +267,8 @@ MyInterceptor myInterceptor = new MyInte
 Server server = serverFactoryBean.create();
 server.getEndpoint().getInInterceptor().add(myInterceptor);
 </pre>
-</div></div>
-
-<p>On the Client side the process is very similar:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">
-import org.apache.cxf.endpoint.Client;
+</div></div><p>On the Client side the process is very similar:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.frontend.ClientProxy;
 ...
 
@@ -347,12 +283,8 @@ cxfClient.getInInterceptors().add(myInte
 // then you can call the service
 client.doSomething();
 </pre>
-</div></div>
-
-<p>You can also use annotation to add the interceptors from the SEI or service 
class. When CXF create the server or client, CXF will add the interceptor 
according with the annotation.</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">
-@org.apache.cxf.interceptor.InInterceptors (interceptors = 
{"com.example.Test1Interceptor" })
+</div></div><p>You can also use annotation to add the interceptors from the 
SEI or service class. When CXF create the server or client, CXF will add the 
interceptor according with the annotation.</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">@org.apache.cxf.interceptor.InInterceptors 
(interceptors = {"com.example.Test1Interceptor" })
 @org.apache.cxf.interceptor.InFaultInterceptors (interceptors = 
{"com.example.Test2Interceptor" })
 @org.apache.cxf.interceptor.OutInterceptors (interceptors = 
{"com.example.Test1Interceptor" })
 @org.apache.cxf.interceptor.InFaultInterceptors (interceptors = 
{"com.example.Test2Interceptor","com.example.Test3Intercetpor" })
@@ -365,16 +297,8 @@ public class SayHiImplementation impleme
    ...
 }
 </pre>
-</div></div>
-
-<h2 id="Interceptors-Addinginterceptorsthroughconfiguration">Adding 
interceptors through configuration</h2>
-
-<p>The <a shape="rect" href="configuration.html">configuration file</a> page 
provides examples on using configuration files to add interceptors.</p>
-
-<p>Adding MyInterceptor to the bus:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">
-&lt;beans xmlns="http://www.springframework.org/schema/beans";
+</div></div><h2 
id="Interceptors-Addinginterceptorsthroughconfiguration">Adding interceptors 
through configuration</h2><p>The <a shape="rect" 
href="configuration.html">configuration file</a> page provides examples on 
using configuration files to add interceptors.</p><p>Adding MyInterceptor to 
the bus:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">&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="
@@ -396,14 +320,8 @@ http://cxf.apache.org/core http://cxf.ap
 &lt;/beans&gt;
 
 </pre>
-</div></div>
-
-<p>For embedded Jetty-based web services, the configuration file can be 
declared by starting the service with the -Dcxf.config.file=server.xml option.  
See the <a shape="rect" class="external-link" href="http://tinyurl.com/2c9fuf"; 
rel="nofollow">server configuration</a> section on the configuration file page 
for information on specifying the file for servlet WAR file-based web service 
implementations.</p>
-
-<p>Adding MyInterceptor to your client:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">
-&lt;beans xmlns="http://www.springframework.org/schema/beans";
+</div></div><p>For embedded Jetty-based web services, the configuration file 
can be declared by starting the service with the -Dcxf.config.file=server.xml 
option. See the <a shape="rect" class="external-link" 
href="http://tinyurl.com/2c9fuf"; rel="nofollow">server configuration</a> 
section on the configuration file page for information on specifying the file 
for servlet WAR file-based web service implementations.</p><p>Adding 
MyInterceptor to your client:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: xml; gutter: false; theme: Default" 
style="font-size:12px;">&lt;beans 
xmlns="http://www.springframework.org/schema/beans";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xmlns:http="http://cxf.apache.org/transports/http/configuration";
        xsi:schemaLocation="http://cxf.apache.org/transports/http/configuration 
http://cxf.apache.org/schemas/configuration/http-conf.xsd
@@ -427,24 +345,7 @@ http://cxf.apache.org/core http://cxf.ap
     &lt;/bean&gt;
 &lt;/beans&gt;
 </pre>
-</div></div>
-
-<p>To specify the client-side configuration file, start your client using the 
-Dcxf.config.file=client.xml option.</p>
-
-
-
-<h2 id="Interceptors-CXFcontributedinterceptors">CXF contributed 
interceptors</h2>
-<p>In CXF, all the functionality of processing messages is done via 
interceptors.   Thus, when debugging a message flow, you will come across a 
bunch of interceptors in the chain.   Here is a list of some of the common 
interceptors and the functionality they provide.  The source code for these 
interceptors (latest trunk version) can be viewed with <a shape="rect" 
class="external-link" href="http://tinyurl.com/y65b5x3"; rel="nofollow">this 
Fisheye query</a>.</p>
-
-
-<h4 id="Interceptors-DefaultJAX-WSIncominginterceptorchain(Server):">Default 
JAX-WS Incoming interceptor chain (Server):</h4>
-<ul><li><strong>AttachmentInInterceptor</strong> Parse the mime headers for 
mime boundaries, finds the "root" part and resets the input stream to it, and 
stores the other parts in a collection of 
Attachments</li><li><strong>StaxInInterceptor</strong>     Creates an 
XMLStreamReader from the transport InputStream on the 
Message</li><li><strong>ReadHeadersInterceptor</strong>  Parses the SOAP 
headers and stores them on the 
Message</li><li><strong>SoapActionInInterceptor</strong> Parses "soapaction" 
header and looks up the operation if a unique operation can be found for that 
action.</li><li><strong>MustUnderstandInterceptor</strong>  Checks the 
MustUnderstand headers, its applicability and process it, if 
required</li><li><strong>SOAPHandlerInterceptor</strong> SOAP Handler as per 
JAX-WS</li><li><strong>LogicalHandlerInInterceptor</strong> Logical Handler as 
per JAX-WS</li><li><strong>CheckFaultInterceptor</strong>  Checks for fault, if 
present aborts interceptor chain and invokes fault ha
 ndler chain</li><li><strong>URIMappingInterceptor</strong> Can handle HTTP 
GET, extracts operation info and sets the same in the 
Message</li><li><strong>DocLiteralnInterceptor</strong> Examines the first 
element in the SOAP body to determine the appropriate Operation (if soapAction 
did not find one) and calls the Databinding to read in the 
data.</li><li><strong>SoapHeaderInterceptor</strong> Perform databinding of the 
SOAP headers for headers that are mapped to 
parameters</li><li><strong>WrapperClassInInterceptor</strong> For wrapped 
doc/lit, the DocLiteralInInterceptor probably read in a single JAXB bean.  This 
interceptor pulls the individual parts out of that bean to construct the 
Object[] needed to invoke the 
service.</li><li><strong>SwAInInterceptor</strong> For Soap w/ Attachments, 
finds the appropriate attachments and assigns them to the correct spot in the 
parameter list.</li><li><strong>HolderInInterceptor</strong> For OUT and IN/OUT 
parameters, JAX-WS needs to create Holde
 r objects.   This interceptor creates the Holders and puts them in the 
parameter list.</li><li><strong>ServiceInvokerInInterceptor</strong> Actually 
invokes the service.</li></ul>
-
-
-
-<h3 id="Interceptors-DefaultOutgoingchainstack(Server):">Default Outgoing 
chain stack (Server):</h3>
-<ul><li><strong>HolderOutInterceptor</strong> For OUT and IN/OUT params, pulls 
the values out of the JAX-WS Holder objects (created in HolderInInterceptor) 
and adds them to the param list for the out 
message.</li><li><strong>SwAOutInterceptor</strong> For OUT parts that are Soap 
attachments, pulls them from the list and holds them for 
later.</li><li><strong>WrapperClassOutInterceptor</strong> For doc/lit wrapped, 
takes the remaining parts and creates a wrapper JAXB bean to represent the 
whole message.</li><li><strong>SoapHeaderOutFilterInterceptor</strong>  Removes 
inbound marked headers</li><li><strong>SoapActionOutInterceptor</strong> Sets 
the SOAP Action</li><li><strong>MessageSenderInterceptor</strong> Calls back to 
the Destination object to have it setup the output streams, headers, etc... to 
prepare the outgoing 
transport.</li><li><strong>SoapPreProtocolOutInterceptor</strong>  This 
interceptor is responsible for setting up the SOAP version and header, so that 
this is availabl
 e to any pre-protocol interceptors that require these to be 
available.</li><li><strong>AttachmentOutInterceptor</strong> If this service 
uses attachments (either SwA or if MTOM is enabled), it sets up the Attachment 
marshallers and the mime stuff that is 
needed.</li><li><strong>StaxOutInterceptor</strong>     Creates an 
XMLStreamWriter from the OutputStream on the 
Message.</li><li><strong>SoapHandlerInterceptor</strong> JAX-WS 
SOAPHandler</li><li><strong>SoapOutInterceptor</strong>         Writes start 
element for soap:envelope and complete elements for other header blocks in the 
message. Adds start element for soap:body 
too.</li><li><strong>LogicalHandlerOutInterceptor</strong> JAX-WS Logical 
handler stuff</li><li><strong>WrapperOutInterceptor</strong> If wrapped doc/lit 
and not using a wrapper bean or if RPC lit, outputs the wrapper element to the 
stream.</li><li><strong>BareOutInterceptor</strong> Uses the databinding to 
write the params out.</li><li><strong>SoapOutInterceptor$SoapOutEndin
 gInterceptor</strong> Closes the soap:body and 
soap:envelope</li><li><strong>StaxOutInterceptor$StaxOutEndingInterceptor</strong>
 Flushes the stax 
stream.</li><li><strong>MessageSenderInt$MessageSenderEnding</strong> Closes 
the exchange, lets the transport know everything is done and should be flushed 
to the client.</li></ul>
-</div>
+</div></div><p>To specify the client-side configuration file, start your 
client using the -Dcxf.config.file=client.xml option.</p><h2 
id="Interceptors-CXFcontributedinterceptors">CXF contributed 
interceptors</h2><p>In CXF, all the functionality of processing messages is 
done via interceptors. Thus, when debugging a message flow, you will come 
across a bunch of interceptors in the chain. Here is a list of some of the 
common interceptors and the functionality they provide. The source code for 
these interceptors (latest trunk version) can be viewed with <a shape="rect" 
class="external-link" href="http://tinyurl.com/y65b5x3"; rel="nofollow">this 
Fisheye query</a>.</p><h4 
id="Interceptors-DefaultJAX-WSIncominginterceptorchain(Server):">Default JAX-WS 
Incoming interceptor chain 
(Server):</h4><ul><li><strong>AttachmentInInterceptor</strong> Parse the mime 
headers for mime boundaries, finds the "root" part and resets the input stream 
to it, and stores the other parts in a collection of Attac
 hments</li><li><strong>StaxInInterceptor</strong> Creates an XMLStreamReader 
from the transport InputStream on the 
Message</li><li><strong>ReadHeadersInterceptor</strong> Parses the SOAP headers 
and stores them on the Message</li><li><strong>SoapActionInInterceptor</strong> 
Parses "soapaction" header and looks up the operation if a unique operation can 
be found for that action.</li><li><strong>MustUnderstandInterceptor</strong> 
Checks the MustUnderstand headers, its applicability and process it, if 
required</li><li><strong>SOAPHandlerInterceptor</strong> SOAP Handler as per 
JAX-WS</li><li><strong>LogicalHandlerInInterceptor</strong> Logical Handler as 
per JAX-WS</li><li><strong>CheckFaultInterceptor</strong> Checks for fault, if 
present aborts interceptor chain and invokes fault handler 
chain</li><li><strong>URIMappingInterceptor</strong> (for CXF versions &lt;= 
2.x) Can handle HTTP GET, extracts operation info and sets the same in the 
Message</li><li><strong>DocLiteralnInterceptor<
 /strong> Examines the first element in the SOAP body to determine the 
appropriate Operation (if soapAction did not find one) and calls the 
Databinding to read in the data.</li><li><strong>SoapHeaderInterceptor</strong> 
Perform databinding of the SOAP headers for headers that are mapped to 
parameters</li><li><strong>WrapperClassInInterceptor</strong> For wrapped 
doc/lit, the DocLiteralInInterceptor probably read in a single JAXB bean. This 
interceptor pulls the individual parts out of that bean to construct the 
Object[] needed to invoke the 
service.</li><li><strong>SwAInInterceptor</strong> For Soap w/ Attachments, 
finds the appropriate attachments and assigns them to the correct spot in the 
parameter list.</li><li><strong>HolderInInterceptor</strong> For OUT and IN/OUT 
parameters, JAX-WS needs to create Holder objects. This interceptor creates the 
Holders and puts them in the parameter 
list.</li><li><strong>ServiceInvokerInInterceptor</strong> Actually invokes the 
service.</li></ul>
 <h3 id="Interceptors-DefaultOutgoingchainstack(Server):">Default Outgoing 
chain stack (Server):</h3><ul><li><strong>HolderOutInterceptor</strong> For OUT 
and IN/OUT params, pulls the values out of the JAX-WS Holder objects (created 
in HolderInInterceptor) and adds them to the param list for the out 
message.</li><li><strong>SwAOutInterceptor</strong> For OUT parts that are Soap 
attachments, pulls them from the list and holds them for 
later.</li><li><strong>WrapperClassOutInterceptor</strong> For doc/lit wrapped, 
takes the remaining parts and creates a wrapper JAXB bean to represent the 
whole message.</li><li><strong>SoapHeaderOutFilterInterceptor</strong> Removes 
inbound marked headers</li><li><strong>SoapActionOutInterceptor</strong> Sets 
the SOAP Action</li><li><strong>MessageSenderInterceptor</strong> Calls back to 
the Destination object to have it setup the output streams, headers, etc... to 
prepare the outgoing 
transport.</li><li><strong>SoapPreProtocolOutInterceptor</strong> Th
 is interceptor is responsible for setting up the SOAP version and header, so 
that this is available to any pre-protocol interceptors that require these to 
be available.</li><li><strong>AttachmentOutInterceptor</strong> If this service 
uses attachments (either SwA or if MTOM is enabled), it sets up the Attachment 
marshallers and the mime stuff that is 
needed.</li><li><strong>StaxOutInterceptor</strong> Creates an XMLStreamWriter 
from the OutputStream on the 
Message.</li><li><strong>SoapHandlerInterceptor</strong> JAX-WS 
SOAPHandler</li><li><strong>SoapOutInterceptor</strong> Writes start element 
for soap:envelope and complete elements for other header blocks in the message. 
Adds start element for soap:body 
too.</li><li><strong>LogicalHandlerOutInterceptor</strong> JAX-WS Logical 
handler stuff</li><li><strong>WrapperOutInterceptor</strong> If wrapped doc/lit 
and not using a wrapper bean or if RPC lit, outputs the wrapper element to the 
stream.</li><li><strong>BareOutInterceptor</stron
 g> Uses the databinding to write the params 
out.</li><li><strong>SoapOutInterceptor$SoapOutEndingInterceptor</strong> 
Closes the soap:body and 
soap:envelope</li><li><strong>StaxOutInterceptor$StaxOutEndingInterceptor</strong>
 Flushes the stax 
stream.</li><li><strong>MessageSenderInt$MessageSenderEnding</strong> Closes 
the exchange, lets the transport know everything is done and should be flushed 
to the client.</li></ul></div>
            </div>
            <!-- Content -->
          </td>


Reply via email to