SeamFramework.orgCommunity Documentation

Chapter 60. RESTEasy Client Framework Integration

60.1. Using RESTEasy Client Framework with Seam REST
60.2. Manual ClientRequest API
60.3. Client Executor Configuration

The RESTEasy Client Framework is a framework for writing clients for REST-based web services. It reuses JAX-RS metadata for creating HTTP requests. For more information about the framework, refer to the project documentation .

Integration with the RESTEasy Client Framework is optional in Seam REST and only available when RESTEasy is available on classpath.


Although RESTEasy is part of JBoss AS 7, not all of the required dependencies are exposed to the application classpath automatically. To enable RESTEasy Client Framework on JBoss AS 7, add the following line to META-INF/MANIFEST.MF

Dependencies: org.apache.httpcomponents

Let us assume as an example that a remote server exposes a web service for providing task details to the client through the TaskService interface below.

To access the remote web service, Seam REST builds and injects a client object of the web service.

The Seam REST module injects a proxied TaskService interface and the RESTEasy Client Framework converts every method invocation on the TaskService to an HTTP request and sends it over the wire to . The HTTP response is unmarshalled automatically and the response object is returned by the method call.

URI definition supports EL expressions.

@Inject @RestClient("#{example.service.uri}")

Besides proxying JAX-RS interfaces, the RESTEasy Client Framework provides the ClientRequest API for manual building of HTTP requests. For more information on the ClientRequest API, refer to the project documentation .

If not specified otherwise, every request is executed by the default Apache HTTP Client 4 configuration. Provide an alternative ClientExecutor implementation to change this.