question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: add automatic generation of sub-resource locator methods

See original GitHub issue

Ideally, RestyGWT would be able to generate proxy methods that would emulate synchronous clients’ JAX-RS sub-resource locator methods. These methods might look something like this in Resty async version:

public interface Book
{
   @GET
   @Path("/title")
   void getTitle(MethodCallback<String> cb);

   @Path("{number}")
   Chapter getChapter(@PathParam("number") int number);
}

public interface Chapter
{
   @GET
   @Path("title")
  void getTitle(MethodCallback<String> cb);

   @GET
   @Path("body")
   void getBody(MethodCallback<String> cb);
}

As you can see, the Book.getChapter(int) method is not asynchronous and does not have an HTTP method annotation (@GET, @POST, etc). The code generator could generate code that would create the appropriate sub-resource URL for this and return a new proxy for the subresource.

I’d be happy to implement this if you give me the thumbs up that you think its a decent idea.

Many of the JAX-RS proxy generation clients do the analogous operation against JAX-RS annotated shared interfaces.

Thanks for Resty! It ROCKS!

Issue Analytics

  • State:closed
  • Created 12 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
glucascommented, Dec 22, 2015

Would it be possible to extend this to work for DirectRestService interfaces as well? Currently sub-resource locators only seem to work for the RestService interface.

0reactions
yarrumretepcommented, Aug 27, 2011

OK then, I’m on it. Will file a pull request when complete

Read more comments on GitHub >

github_iconTop Results From Across the Web

31.3 Subresources and Runtime Resource Resolution - Java ...
A subresource locator returns an object that will handle an HTTP request. The method must not be annotated with a request method designator....
Read more >
Chapter 15. JAX-RS Resource Locators and Sub Resources
Resource classes are able to partially process a request and provide another "sub" resource object that can process the remainder of the request....
Read more >
RestyGWT / Documentation
RestyGWT supports JAX-RS subresource locator methods as synchronous methods ... RestyGWT rest calls will automatically set the Accept and Content-Type and ...
Read more >
Subresource Locators | RESTful Java with JAX-RS 2.0 ...
Subresource locators are Java methods annotated with @Path, but with no HTTP method annotation, like @GET, applied to them. This type of method...
Read more >
JAX-RS - Apache CXF Documentation
Custom implementations can check the names of the resource classes or methods being compared and given the current request URI they can make ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found