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 > Annotations
Date Fri, 17 Sep 2010 19:36:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/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/Annotations">Annotations</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" > <br>{anchor:Policy} <br></td></tr>
            <tr><td class="diff-changed-lines" >h3. org.apache.cxf.annotations.Policy
<span class="diff-changed-words">org.apache.cxf.annotations.<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">)</span>Policies</span>
(since 2.3) <br></td></tr>
            <tr><td class="diff-unchanged" >Used to attach WS-Policy fragments
to a service or operation.   The Policy supports the attributes: <br>|uri| *REQUIRED*
the location of the file containing the Policy definition <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
        </table>
</div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <p>CXF provides several custom annotations that can be used to configure and
customize the CXF runtime.</p>

<h3><a name="Annotations-org.apache.cxf.feature.Features"></a>org.apache.cxf.feature.Features</h3>
<p>The @Features annotation is used to add <a href="/confluence/display/CXF20DOC/Features"
title="Features">Features</a>.   See the <a href="/confluence/display/CXF20DOC/FeaturesList"
title="FeaturesList">FeaturesList</a> for the list of Features we provide "out of
the box", but you can easily create your own.   In many cases, however, those features have
Annotations themselves which can be used and provide greater control over configuration.</p>

<h3><a name="Annotations-org.apache.cxf.interceptor.InInterceptors%2C%5C%5Corg.apache.cxf.interceptor.OutInterceptors%2C%5C%5Corg.apache.cxf.interceptor.OutFaultInterceptors%2C%5C%5Corg.apache.cxf.interceptor.InFaultInterceptors"></a>org.apache.cxf.interceptor.InInterceptors,
<br class="atl-forced-newline" /> org.apache.cxf.interceptor.OutInterceptors, <br
class="atl-forced-newline" /> org.apache.cxf.interceptor.OutFaultInterceptors, <br class="atl-forced-newline"
/> org.apache.cxf.interceptor.InFaultInterceptors</h3>
<p>Add interceptors to the various chains used to process messages.  See <a href="/confluence/display/CXF20DOC/Interceptors"
title="Interceptors">Interceptors</a> for more detail.</p>

<p><a name="Annotations-WSDLDocumentation"></a></p>
<h3><a name="Annotations-org.apache.cxf.annotations.WSDLDocumentation%5C%5Corg.apache.cxf.annotations.WSDLDocumentationCollection%28since2.3%29"></a>org.apache.cxf.annotations.WSDLDocumentation
<br class="atl-forced-newline" /> org.apache.cxf.annotations.WSDLDocumentationCollection
 (since 2.3)</h3>
<p>For "java first" scenarios where the WSDL is derived from the Java interfaces/code,
these annotations allow adding wsd:documentation elements to various locations in the generated
wsdl.  </p>

<p>For example:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
@WebService
@WSDLDocumentationCollection(
    {
        @WSDLDocumentation(<span class="code-quote">"My portType documentation"</span>),
        @WSDLDocumentation(value = <span class="code-quote">"My top level documentation"</span>,
                           placement = WSDLDocumentation.Placement.TOP),
        @WSDLDocumentation(value = <span class="code-quote">"My binding doc"</span>,
                           placement = WSDLDocumentation.Placement.BINDING)
    }
)
<span class="code-keyword">public</span> <span class="code-keyword">interface</span>
MyService {

    @WSDLDocumentation(<span class="code-quote">"The docs <span class="code-keyword">for</span>
echoString"</span>)
    <span class="code-object">String</span> echoString(<span class="code-object">String</span>
s);

}
</pre>
</div></div>

<p><a name="Annotations-SchemaValidation"></a></p>
<h3><a name="Annotations-org.apache.cxf.annotations.SchemaValidation%28since2.3%29"></a>org.apache.cxf.annotations.SchemaValidation
 (since 2.3)</h3>
<p>Turns on SchemaValidation for messages.   By default, for performance reasons, CXF
does not validate message against the schema.   By turning on validation, problems with messages
not matching the schema are easier to determine.</p>

<p><a name="Annotations-DataBinding"></a></p>
<h3><a name="Annotations-org.apache.cxf.annotations.DataBinding%28since2.2.4%29"></a>org.apache.cxf.annotations.DataBinding
 (since 2.2.4)</h3>
<p>Sets the DataBinding class that is associated with the service.   By default, CXF
assumes you are using the JAXB data binding.   However, CXF supports different databindings
such as XMLBeans, Aegis, SDO, and possibly more.   This annotation can be used in place of
configuration to select the databinding class.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
@DataBinding(org.apache.cxf.sdo.SDODataBinding.class)
<span class="code-keyword">public</span> <span class="code-keyword">interface</span>
MyService {
    <span class="code-keyword">public</span> commonj.sdo.DataObject echoStruct(
        commonj.sdo.DataObject struct
    );
}
</pre>
</div></div>

<p><a name="Annotations-Logging"></a></p>
<h3><a name="Annotations-org.apache.cxf.annotations.Logging%28since2.3%29"></a>org.apache.cxf.annotations.Logging
 (since 2.3)</h3>
<p>Turns on logging for the endpoint.   Can be used to control the size limits of what
gets logged as well as the location.  It supports the following attributes:</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<td class='confluenceTd'>limit </td>
<td class='confluenceTd'> Sets the size limit after which the message is truncated in
the logs.  Default is 64K</td>
</tr>
<tr>
<td class='confluenceTd'>inLocation </td>
<td class='confluenceTd'> Sets the location to log incoming messages.  Can be &lt;stderr&gt;,
&lt;stdout&gt;, &lt;logger&gt;, or a file: URL.  Default is &lt;logger&gt;</td>
</tr>
<tr>
<td class='confluenceTd'>outLocation </td>
<td class='confluenceTd'> Sets the location to log outgoing messages.  Can be &lt;stderr&gt;,
&lt;stdout&gt;, &lt;logger&gt;, or a file: URL.  Default is &lt;logger&gt;</td>
</tr>
</tbody></table>
</div>



<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
@Logging(limit=16000, inLocation=<span class="code-quote">"&lt;stdout&gt;"</span>)
<span class="code-keyword">public</span> <span class="code-keyword">interface</span>
MyService {

    <span class="code-object">String</span> echoString(<span class="code-object">String</span>
s);

}
</pre>
</div></div>


<p><a name="Annotations-GZIP"></a></p>
<h3><a name="Annotations-org.apache.cxf.annotations.GZIP%28since2.3%29"></a>org.apache.cxf.annotations.GZIP
   (since 2.3)</h3>

<p>Enables GZIP compression of on-the-wire data.  Supported attributes:</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<td class='confluenceTd'>threadhold</td>
<td class='confluenceTd'>the threshold under which messages are not gzipped</td>
</tr>
</tbody></table>
</div>

<p>GZIP is a negotiated enhancement.  An initial request from a client will not be gzipped,
but an Accept header will be added and if the server supports it, the response will be gzipped
and any subsequent requests will be.</p>


<p><a name="Annotations-FastInfoset"></a></p>
<h3><a name="Annotations-org.apache.cxf.annotations.FastInfoset%28since2.3%29"></a>org.apache.cxf.annotations.FastInfoset
  (since 2.3)</h3>
<p>Enables FastInfoset of on-the-wire data.  Supported attributes:</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<td class='confluenceTd'>force</td>
<td class='confluenceTd'> forces the use of fastinfoset instead of negotiating.  Default
is false</td>
</tr>
</tbody></table>
</div>

<p>FastInfoset is a negotiated enhancement.  An initial request from a client will not
be in fastinfoset, but an Accept header will be added and if the server supports it, the response
will be in fastinfoset and any subsequent requests will be.</p>

<p><a name="Annotations-EndpointProperty"></a></p>
<h3><a name="Annotations-org.apache.cxf.annotations.EndpointProperty%5C%5Corg.apache.cxf.annotations.EndpointProperties%28since2.3%29"></a>org.apache.cxf.annotations.EndpointProperty
<br class="atl-forced-newline" /> org.apache.cxf.annotations.EndpointProperties (since
2.3)</h3>
<p>Adds a property to an endpoint.  Many things such as WS-Security related things and
such can be configured via endpoint properties.   Traditionally, these would be set via the
&lt;jaxws:properties&gt; element on the &lt;jaxws:endpoint&gt; element in
the spring config, but these annotations allow these properties to be configured into the
code.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
@WebService
@EndpointProperties(
    {
       @EndpointProperty(name = <span class="code-quote">"my.property"</span>,
value=<span class="code-quote">"some value"</span>),
       @EndpointProperty(name = <span class="code-quote">"my.other.property"</span>,
value=<span class="code-quote">"some other value"</span>),
    })
<span class="code-keyword">public</span> <span class="code-keyword">interface</span>
MyService {
    <span class="code-object">String</span> echoString(<span class="code-object">String</span>
s);
}
</pre>
</div></div>

<p><a name="Annotations-Policy"></a></p>
<h3><a name="Annotations-org.apache.cxf.annotations.Policy%5C%5Corg.apache.cxf.annotations.Policies%28since2.3%29"></a>org.apache.cxf.annotations.Policy
<br class="atl-forced-newline" /> org.apache.cxf.annotations.Policies (since 2.3)</h3>
<p>Used to attach WS-Policy fragments to a service or operation.   The Policy supports
the attributes:</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<td class='confluenceTd'>uri</td>
<td class='confluenceTd'> <b>REQUIRED</b> the location of the file containing
the Policy definition</td>
</tr>
<tr>
<td class='confluenceTd'>includeInWSDL</td>
<td class='confluenceTd'> Whether to include the policy in the generated WSDL when generating
a wsdl.  Default it true</td>
</tr>
<tr>
<td class='confluenceTd'>placement</td>
<td class='confluenceTd'> Specify where to place the policy </td>
</tr>
<tr>
<td class='confluenceTd'>faultClass </td>
<td class='confluenceTd'> if placement is a FAULT, this specifies which fault the policy
would apply to </td>
</tr>
</tbody></table>
</div>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">

@Policies({
    @Policy(uri = <span class="code-quote">"annotationpolicies/TestInterfacePolicy.xml"</span>),
    @Policy(uri = <span class="code-quote">"annotationpolicies/TestImplPolicy.xml"</span>,
            placement = Policy.Placement.SERVICE_PORT),
    @Policy(uri = <span class="code-quote">"annotationpolicies/TestPortTypePolicy.xml"</span>,

            placement = Policy.Placement.PORT_TYPE)
}
)
@WebService
<span class="code-keyword">public</span> <span class="code-keyword">static</span>
<span class="code-keyword">interface</span> TestInterface {
    @Policies({
        @Policy(uri = <span class="code-quote">"annotationpolicies/TestOperationPolicy.xml"</span>),
        @Policy(uri = <span class="code-quote">"annotationpolicies/TestOperationInputPolicy.xml"</span>,

                placement = Policy.Placement.BINDING_OPERATION_INPUT),
        @Policy(uri = <span class="code-quote">"annotationpolicies/TestOperationOutputPolicy.xml"</span>,

                placement = Policy.Placement.BINDING_OPERATION_OUTPUT),
        @Policy(uri = <span class="code-quote">"annotationpolicies/TestOperationPTPolicy.xml"</span>,

                placement = Policy.Placement.PORT_TYPE_OPERATION),
        @Policy(uri = <span class="code-quote">"annotationpolicies/TestOperationPTInputPolicy.xml"</span>,

                placement = Policy.Placement.PORT_TYPE_OPERATION_INPUT),
        @Policy(uri = <span class="code-quote">"annotationpolicies/TestOperationPTOutputPolicy.xml"</span>,

                placement = Policy.Placement.PORT_TYPE_OPERATION_OUTPUT)
    }
    )
    <span class="code-object">int</span> echoInt(<span class="code-object">int</span>
i);
}

</pre>
</div></div>
    </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/Annotations">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=2330263&revisedVersion=8&originalVersion=7">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/Annotations?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message