Java Reference
In-Depth Information
rated with JBoss Application Server, thus making the user experience nicer in that
environment.
Besides the server-side specification, RESTEasy has been innovative in bringing
JAX-RS to the client through the RESTEasy JAX-RS Client Framework . This
client-side framework allows you to map outgoing HTTP requests to remote servers
using JAX-RS annotations and interface proxies.
Activating RESTEasy
RESTEasy is bundled with JBoss AS 7, so you need very little effort to get started.
At first, you must at least provide an empty web.xml file:
<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/
XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/
xml/ns/javaee http://java.sun.com/xml/ns/javaee/
web-app_3_0.xsd">
</web-app>
Once you have completed the web.xml file, you just need to activate the JAX-
RS resources by declaring the application path used by your REST service, using
the
annotation
in
a
class
that
extends
@ApplicationPath
javax.ws.rs.core.Application :
@ApplicationPath("/rest")
public class JaxRsActivator extends Application
{
}
This simply means that if we were to deploy our former example, the HTTP GET
method, http://host/example/rest/users would trigger our getUser busi-
ness method; while the same URL would place a request through the
handlePOSTRequest method using a POST request.
Search WWH ::




Custom Search