Details
-
Feature Request
-
Resolution: Done
-
Major
-
2.0.GA
-
None
-
None
Description
Resource locators are not supported in the AJAX client. This should be fixed.
Ex:
@Path("/")
public class Resource {
@Path("
{id}")
public SubResource getLocator(@PathParam("id") String id)
}
@Path("
{more}")
public class Locator {
private String id;
public Locator(String id)
{ thid.id = id; } @GET
public String getMethod(@PathParam("more") String more)
}
There are two ways to fix this:
- The easy way is to support a syntax like Resource.getLocator.getMethod(
{id: "a", more: "b"}
) but this is static and only works for statically declared resource locators (the method's return type), and not dynamic as per JAX-RS specs. This is a hack but relatively easy to do.
- The hard way is to make easy locator call execute an AJAX query to the JS API servlet in order to get the next set of functions dynamically: Resource.getLocator(
{id: "a"}
).getMethod(
{more: "b"}), which would make two calls. The first one (Resource.getLocator(
{id: "a"})) would return an object bound with the JS API for the Locator resource with "id" already bound, while the second (.getMethod(
{more: "b"})) would invoke that method.
Note that this is related in some way to the Link auto-discovery which I should add as well to the AJAX client.