This page outlines the three options you have for deploying JAX-RS applications in WildFly 8. These three methods are specified in the JAX-RS 1.1 specification in section 2.3.2.
Subclassing javax.ws.rs.core.Application and using @ApplicationPath
This is the easiest way and does not require any xml configuration. Simply include a subclass of javax.ws.rs.core.Application in your application, and annotate it with the path that you want your JAX-RS classes to be available. For example:
This will make your JAX-RS resources available under /mywebappcontext/mypath.
![]() | Note that that the path is /mypath not /mypath/* |
Subclassing javax.ws.rs.core.Application and using web.xml
If you do not wish to use @ApplicationPath but still need to subclass Application you can set up the JAX-RS mapping in web.xml:
This will make your JAX-RS resources available under /mywebappcontext/hello.
![]() | You can also use this approach to override an application path set with the @ApplicationPath annotation. |
Using web.xml
If you don't wan't to subclass Application you can set the JAX-RS mapping in web.xml as follows:
This will make your JAX-RS resources available under /mywebappcontext/hello.
![]() | Note that you only have to add the mapping, not the corresponding servlet. The server is responsible for adding the corresponding servlet automatically. |