|
|||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | ||||||||
See:
Description
| Class Summary | |
|---|---|
| WebResourceFactory | Factory for client-side representation of a resource. |
This package defines a high-level (proxy-based) client API. The API enables utilization of the server-side JAX-RS annotations to describe the server-side resources and dynamically generate client-side proxy objects for them.
Consider a server which exposes a resource at http://localhost:8080. The resource can be described by the following interface:
@Path("myresource")
public interface MyResourceIfc {
@GET
@Produces("text/plain")
String get();
@POST
@Consumes("application/xml")
@Produces("application/xml")
MyBean postEcho(MyBean bean);
@Path("{id}")
@GET
@Produces("text/plain")
String getById(@PathParam("id") String id);
}
You can use WebResourceFactory class defined in this package to access the server-side resource using this interface. Here is an example:
Client c = ClientBuilder.newClient();
MyResourceIfc resource = WebResourceFactory.newWebResource(MyResourceIfc.class, c, "http://localhost:8080/");
String responseFromGet = resource.get();
MyBean responseFromPost = resource.postEcho(myBeanInstance);
String responseFromGetById = resource.getById("abc");
|
|||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | ||||||||