Java Reference
In-Depth Information
JBoss REST web services
Having understood the basics of REST services, let's see how we can develop a RESTful
web service using WildFly. The application server includes an out-of-the-box RESTEasy
library that is a portable implementation of the JSR-339 specification. RESTEasy can run
in any servlet container; however, it is perfectly integrated with WildFly, thus making the
user experience nicer in that environment.
Besides the server-side specification, in the past, RESTEasy has been innovative in bring-
ing JAX-RS to the client through the RESTEasy JAX-RS Client Framework . However,
the latest version of the JAX-RS specification comes with a client API, which we can use
in every JAX-RS implementation.
Activating JAX-RS
RESTEasy is bundled with WildFly, so you need very little effort to get started. You have
two choices. The first one is to use the @ApplicationPath annotation in a class that
extends javax.ws.rs.core.Application :
@ApplicationPath("/rest")
public class JaxRsActivator extends Application {
}
The second choice is less popular and used to configure the application using a web.xml
file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_3_0.xsd"
version="3.0">
<servlet>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
Search WWH ::




Custom Search