Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.Ce contenu n'est pas disponible dans la langue sélectionnée.
52.2. JBoss Fuse CXF Implementations
Overview Copier lienLien copié sur presse-papiers!
Copier lienLien copié sur presse-papiers!
This section describes how to use the SwaggerFeature in JBoss Fuse CXF implementations, in which REST services are defined inside JAR files and deployed to a JBoss Fuse container or a fabric8 container.
Your JBoss 6.2 installation contains a Quickstart (installDir
/quickstarts/cxf/rest/
) that demonstrates how to create a RESTful (JAX-RS) web service using CXF and how to enable Swagger and annotate the JAX-RS endpoints.
Enabling Swagger Copier lienLien copié sur presse-papiers!
Copier lienLien copié sur presse-papiers!
Enabling Swagger involves:
- Modifying the XML file that defines the CXF service by adding the CXF class (
io.fabric8.cxf.endpoint.SwaggerFeature
) to the<jaxrs:server>
definition.For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - In the REST resource class:
- Importing the Swagger API annotations for each annotation required by the service:
import com.wordnik.swagger.annotations.Api*
where * = Api, ApiOperation, ApiParam, ApiResponse, ApiResponses, and so on.For details, see https://github.com/swagger-api/swagger-core/wiki/Annotations. - Adding Swagger annotations to the JAX-RS annotated endpoints (@PATH, @PUT, @POST, @GET, @Produces, @Consumes, @DELETE, @PathParam, and so on).For an example, see Example 52.2, “Example REST resource with Swagger annotations”.
Building and Deploying the Rest quickstart Copier lienLien copié sur presse-papiers!
Copier lienLien copié sur presse-papiers!
See the README file in your JBoss Fuse 6.2 installDir
/quickstarts/cxf/rest/
directory for instructions on how to build and deploy the rest quickstart.