Package retrofit

Examples of retrofit.RestAdapter


    query.setTimeoutMilliseconds(READ_TIMEOUT_IN_MILLISECONDS);
    return sonar.findAll(query);
  }

  public Rule getRule(String key) {
    RestAdapter restAdapter = new RestAdapter.Builder()
        .setEndpoint(mySonarServerConfig.getHostUrl())
        .setLogLevel(RestAdapter.LogLevel.FULL)
        .build();

    final Rules rules = restAdapter.create(Rules.class);
    final Rule rule = rules.show(key, null).rule;
    return rule;
  }
View Full Code Here


  private static final Logger LOG = LoggerFactory.getLogger(AsynchronousClient.class);
 
  public static void main(String[] args) {
    // Build the Retrofit REST adaptor pointing to the URL specified
    // with a ThrottlingInterceptor allowing only 1 request per second
    RestAdapter restAdapter = new RestAdapter.Builder()
      .setRequestInterceptor(new ThrottlingInterceptor(1000L))
          .setServer(API_URL)
          .build();
 
    // Create an instance of our InterestingApi interface.
    InterestingApi synchronousApi = restAdapter.create(InterestingApi.class);
   
      // Create an instance of our AsynchronousApi interface.
    AsynchronousApi asyncApi = restAdapter.create(AsynchronousApi.class);
   
    for(int i = 0; i < 10; i++)
      LOG.info("synchronousApi " + synchronousApi.getWithPath(Integer.toString(i)));
   
    for(int i = 0; i < 10; i++)
View Full Code Here

  private static final String API_URL = "http://localhost:8080/";
  private static final Logger LOG = LoggerFactory.getLogger(SimpleClient.class);
 
  public static void main(String[] args) {
    // Build the Retrofit REST adaptor pointing to the URL specified
    RestAdapter restAdapter = new RestAdapter.Builder()
          .setServer(API_URL)
          .build();
 
      // Create an instance of our SimpleApi interface.
    SimpleApi simpleApi = restAdapter.create(SimpleApi.class);
 
    // Call each of the methods and output the results
    System.out.println("simpleApi.simpleGet()=<<" + simpleApi.simpleGet() + ">>");
    System.out.println("simpleApi.simplePost()=<<" + simpleApi.simplePost() + ">>");
    System.out.println("simpleApi.simpleDelete()=<<" + simpleApi.simpleDelete() + ">>");
View Full Code Here

    // Create our Converter
    JacksonConverter converter = new JacksonConverter(new ObjectMapper());
   
    // Build the Retrofit REST adaptor pointing to the URL specified, with the Converter.
    // Note: The Converter must be set before the .build() command
    RestAdapter restAdapter = new RestAdapter.Builder()
      .setConverter(converter)
          .setServer(API_URL)
          .build();
 
      // Create an instance of our InterestingApi interface.
    InterestingApi api = restAdapter.create(InterestingApi.class);
   
    // Call each of the methods and output the results
    System.out.println("api.getDate()={" + api.getDate() + "}");
    System.out.println("api.getWithPath()={" + api.getWithPath("my String 1234") + "}");
    System.out.println("api.getWithQuery()={" + api.getWithQuery("my String 1234") + "}");
View Full Code Here

  public static WebHookService createWebHookService(final String url) {

    final OkHttpClient client = ProcessorHelper.createClient();

    final RestAdapter restAdapter = new RestAdapter.Builder()
        .setEndpoint(url).setClient(new OkClient(client)).build();

    return restAdapter.create(WebHookService.class);
  }
View Full Code Here

TOP

Related Classes of retrofit.RestAdapter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.