Skip to content

Spring MVC REST: Provide interface definition model for generating HTTP client interface proxies wrapping RestTemplates [SPR-6261] #10929

Closed

Description

@spring-projects-issues

Alex Antonov opened SPR-6261 and commented

Provide interface definition model for generating HTTP client interface proxies wrapping RestTemplates.

Code implementation to follow.


Affects: 3.0 RC1

Issue Links:

3 votes, 12 watchers

Activity

  1. spring-projects-issues commented on Oct 22, 2009

    @spring-projects-issues
    CollaboratorAuthor

    Alex Antonov commented

    As an example of what an interface would look like:

    public interface ProtobufHotelSearchService {
        @ServiceRequest(name="hotel.id", method= HttpInvocationHandler.RequestMethod.GET, pattern = "/${id}")
        public HotelProtos.Hotel findHotelById(@ParamName("id") Long id);
    
        @ServiceRequest(name="hotel.search", method= HttpInvocationHandler.RequestMethod.GET)
        public HotelProtos.HotelList findHotels(@ParamName("search") String search,
                                                @ParamName("page") int page,
                                                @ParamName("size") int size);
    
        @ServiceRequest(name="hotel.update")
        public void updateHotels(HotelProtos.Hotel h);
    }
    

    @ServiceRequest annotation would indicate to the invocation handler what HTTP call you are going to make.
    @ParamName is similar to @RequestParam & @PathVariable from MVC

    Those then get processed by the invocation handler to determine what the URL should look like, what HTTP method (GET, PUT, etc) should be executed, etc... After all that is figured out, a delegate call to RestTemplate can be made to actually process the request.

  2. spring-projects-issues commented on Jul 4, 2016

    @spring-projects-issues
    CollaboratorAuthor

    Marten Deinum commented

    I guess this is what Netflix Feign already provides on the plain Spring MVC annotations.

  3. spring-projects-issues commented on Sep 22, 2016

    @spring-projects-issues
    CollaboratorAuthor

    Rossen Stoyanchev commented

    Yes indeed it is the same although a much older ticket. I will resolve it as superseded by the likes of #16827 and #16747 that are currently under consideration.

  4. added
    type: enhancement
    status: duplicate
    in: web
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: webstatus: duplicatetype: enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions