<dependency> <groupId>org.wildfly.swarm</groupId> <artifactId>jaxrs</artifactId> </dependency>
JAX-RS is a standard JavaEE API for defining web services. It can be used to replace
Servlet-based applications where resources are well-defined, such as in RESTful architectures.
WildFly Swarm supports JAX-RS with both
To bring JAX-RS functionality to your application, you need the following dependency:
jaxrs fraction brings the JAX-RS APIs to your application through a transitive dependency. It also provides a
JAXRSArchive archive type for easily creating JAX-RS-based deployments if you provide your own
JAXRSArchive deployment = ShrinkWrap.create( JAXRSArchive.class ); deployment.addResource( SomeResource.class );
Use of the
jaxrs fraction dependency provides a default
Application with the
@ApplicationPath annotation if you do not provide one when creating the deployment. If you do provide an
Application it will take precedence.
Using JAX-RS with CDI
By default, JAX-RS does not provide CDI support. To bring CDI support to your application, an additional dependency is required:
<dependency> <groupId>org.wildfly.swarm</groupId> <artifactId>cdi</artifactId> </dependency>
With this fraction in place, you can inject dependencies into your JAX-RS endpoints using
@Inject, benefit from CDI interceptors and more.
Using JAX-RS with multipart forms
To use JAX-RS with multipart forms (to support file uploads, for instance), another dependency is required:
<dependency> <groupId>org.wildfly.swarm</groupId> <artifactId>jaxrs-multipart</artifact> </dependency>