AnnotationsPage edited by Daniel KulpChanges (1)
Full ContentCXF provides several custom annotations that can be used to configure and customize the CXF runtime. org.apache.cxf.feature.FeaturesThe @Features annotation is used to add Features. See the FeaturesList 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. org.apache.cxf.interceptor.InInterceptors,
|
| limit | Sets the size limit after which the message is truncated in the logs. Default is 64K |
| inLocation | Sets the location to log incoming messages. Can be <stderr>, <stdout>, <logger>, or a file: URL. Default is <logger> |
| outLocation | Sets the location to log outgoing messages. Can be <stderr>, <stdout>, <logger>, or a file: URL. Default is <logger> |
@Logging(limit=16000, inLocation="<stdout>") public interface MyService { String echoString(String s); }
org.apache.cxf.annotations.GZIP (since 2.3)
Enables GZIP compression of on-the-wire data. Supported attributes:
| threadhold | the threshold under which messages are not gzipped |
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.
org.apache.cxf.annotations.FastInfoset (since 2.3)
Enables FastInfoset of on-the-wire data. Supported attributes:
| force | forces the use of fastinfoset instead of negotiating. Default is false |
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.
org.apache.cxf.annotations.EndpointProperty
org.apache.cxf.annotations.EndpointProperties (since 2.3)
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 <jaxws:properties> element on the <jaxws:endpoint> element in the spring config, but these annotations allow these properties to be configured into the code.
@WebService
@EndpointProperties(
{
@EndpointProperty(name = "my.property", value="some value"),
@EndpointProperty(name = "my.other.property", value="some other value"),
})
public interface MyService {
String echoString(String s);
}
org.apache.cxf.annotations.Policy
org.apache.cxf.annotations.Policies (since 2.3)
Used to attach WS-Policy fragments to a service or operation. The Policy supports the attributes:
| uri | REQUIRED the location of the file containing the Policy definition |
| includeInWSDL | Whether to include the policy in the generated WSDL when generating a wsdl. Default it true |
| placement | Specify where to place the policy |
| faultClass | if placement is a FAULT, this specifies which fault the policy would apply to |
@Policies({
@Policy(uri = "annotationpolicies/TestInterfacePolicy.xml"),
@Policy(uri = "annotationpolicies/TestImplPolicy.xml",
placement = Policy.Placement.SERVICE_PORT),
@Policy(uri = "annotationpolicies/TestPortTypePolicy.xml",
placement = Policy.Placement.PORT_TYPE)
}
)
@WebService
public static interface TestInterface {
@Policies({
@Policy(uri = "annotationpolicies/TestOperationPolicy.xml"),
@Policy(uri = "annotationpolicies/TestOperationInputPolicy.xml",
placement = Policy.Placement.BINDING_OPERATION_INPUT),
@Policy(uri = "annotationpolicies/TestOperationOutputPolicy.xml",
placement = Policy.Placement.BINDING_OPERATION_OUTPUT),
@Policy(uri = "annotationpolicies/TestOperationPTPolicy.xml",
placement = Policy.Placement.PORT_TYPE_OPERATION),
@Policy(uri = "annotationpolicies/TestOperationPTInputPolicy.xml",
placement = Policy.Placement.PORT_TYPE_OPERATION_INPUT),
@Policy(uri = "annotationpolicies/TestOperationPTOutputPolicy.xml",
placement = Policy.Placement.PORT_TYPE_OPERATION_OUTPUT)
}
)
int echoInt(int i);
}
