Este conteúdo não está disponível no idioma selecionado.
52.2. JBoss Fuse CXF Implementations
Overview Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
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 Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
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 Copiar o linkLink copiado para a área de transferência!
Copiar o linkLink copiado para a área de transferência!
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.