...
Span | ||
---|---|---|
| ||
JAX-RS |
...
Table of Contents |
---|
Introduction
...
CXF 2.7.x and CXF 3.0.0 depending on 2.0-m10 and 2.0 final versions of JAX-RS 2.0 API.
Project setup and configuration
...
Check the specification or ask at the users list for more details.
Maven dependencies
CXF 3.2.0
...
- Complete support for JAX-RS 2.1, please see JAX-RS Basics for more information
- JAX-RS NIO extension based on the early JAX-RS 2.1 API prototype.
- JAX-RS RxJava Observable support: as a standard JAX-RS 2.1 RxInvoker client provider and returning it asynchronously from the resource methods (CXF extension)
- JAX-RS Project Reactor Support also based on the JAX-RS 2.1 RxInvoker paradigm
- Complete support for JAX-RS 2.0, please see JAX-RS Basics for more information
- Bean Validation 1.1 Support, please see http://cxf.apache.org/docs/validationfeature.html for more information
- Swagger Feature for generating Swagger API documentation from JAX-RS endpoints
...
{{ > GET /resource?_type=xml}}
Overriding a request method is also easy:
CXF also supports overriding request methods. However note that by default this is not allowed (since CXF 3.3.4) for a CXF service. To enable HTTP method overriding, specify the "org.apache.cxf.jaxrs.allow.http.method.override" endpoint property as "true".
Two options of overriding HTTP request methods are available - via a query parameter:
> GET /resource?_method=> GET /resource?_method=POST
Alternatively, one can specify an HTTP header X-HTTP-Method-Override:
...
Please also check JAX-RS XML Security, JAX-RS SAML, JAX-RS Token Authorization and JAX-RS OAuth2 pages for more information about the advanced security topics.
...
Please see the DOSGI Reference page ('org.apache.cxf.rs' properties) and a greeter_rest sample for more information. Note that this demo can be run exactly as a SOAP-based greeter demo as it registers and consumes a similar (but) JAX-RS annotated GreeterService. In addition, this demo shows how one can register and consume a given interface (GreeterService2) without using explicit JAX-RS annotations but providing an out-of-band user model description.
OData Support
CXF JAX-RS endpoints can support OData in two ways by relying on Apache Olingo.
First, the OData "$filter" query is supported by the Search extension where an endpoint with the application specific API can respond to the filter queries, for example, return a collection of books matching the fillter search criteria.
Second, CXF JAX-RS can be used to interpose over the Olingo, as is demoed here. Effectively such a CXF endpoint becomes an OData server: all it does it delegates to Olingo. The idea is to be able to add CXF specific features and interceptors in front of Olingo.
Other Advanced Features
CXF JAX-RS provides a number of advanced extensions such as the support for the JMS transport, one-way invocations (HTTP and JMS), suspended invocations (HTTP and JMS), making existing code REST-aware by applying external user models, etc.
...