Feature Request: add automatic generation of sub-resource locator methods
See original GitHub issueIdeally, 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:
- Created 12 years ago
- Comments:6 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
OK then, I’m on it. Will file a pull request when complete