Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-452

Support resource locators in AJAX client

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Done
    • Major
    • Wanted But Unscheduled
    • 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)

      { return new Locator(id); }

      }

      @Path("

      {more}

      ")
      public class Locator {

      private String id;

      public Locator(String id)

      { thid.id = id; }

      @GET
      public String getMethod(@PathParam("more") String more)

      { return "Hello"; }

      }

      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.

      Attachments

        Activity

          People

            patriot1burke@gmail.com Bill Burke (Inactive)
            separdau@redhat.com Stephane Epardaud
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: