Class ApiClientProxy


  • public class ApiClientProxy
    extends Object
    Used to dynamically create a client implementation of a REST-ful interface defined through an Action Controller annotated interface.

    Usage

    Given a Controller interface like the following:
      public interface Controller {
        @Get("/data")
        @ContentBody String getContent(@RequestParam("filter") String filter);
     }
     
    The following will make a request to http://example.com/data?filter=foo and return the content as a string
     String baserUrl = "http://example.com/";
     Controller client = ApiClientProxy.create(Controller.class, new HttpURLConnectionApiClient(baseUrl));
     String response = client.getContent("foo");
     
    • Constructor Detail

      • ApiClientProxy

        public ApiClientProxy()
    • Method Detail

      • create

        public static <T> T create​(Class<T> controllerClass,
                                   ApiClient client)