+

Search Tips   |   Advanced Search

Configure JAX-RS applications using JAX-RS 1.1 methods

We can configure Java API for RESTful Web Services (JAX-RS) applications in multiple ways depending on our needs. To take advantage of the Java EE 6 functionality, we can use the annotation scanning capabilities. By using annotation scanning, we can omit a JAX-RS javax.ws.rs.core.Application subclass or have a minimally defined javax.ws.rs.core.Application subclass.

The JAX-RS 1.1 specification supports several new ways to configure a JAX-RS application.  Use the built-in annotation scanning to help automatically configure the application. We can optionally add javax.ws.rs.core.Application subclasses to the application and then add the URL patterns required using either the javax.ws.rs.ApplicationPath annotation or a web.xml servlet definition. When using the IBM JAX-RS implementation, we do not have to specify the servlet class implementation because it is automatically added to the configuration of the web module by the time the JAX-RS application is started.

When using a web.xml file, we must use a Java Servlet 3.0 web.xml file.


Tasks

We have configured the JAX-RS application using JAX-RS 1.1 supported methods by taking advantage of annotation scanning to help automatically configure the application.

  • Configure the web.xml file for JAX-RS servlets
  • Configure the web.xml file for JAX-RS filters