當前位置: 首頁>>代碼示例>>Java>>正文


Java GET類代碼示例

本文整理匯總了Java中retrofit2.http.GET的典型用法代碼示例。如果您正苦於以下問題:Java GET類的具體用法?Java GET怎麽用?Java GET使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


GET類屬於retrofit2.http包,在下文中一共展示了GET類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getWithEncodedQueryParamMap

import retrofit2.http.GET; //導入依賴的package包/類
@Test public void getWithEncodedQueryParamMap() {
  class Example {
    @GET("/foo/bar/") //
    Call<ResponseBody> method(@QueryMap(encoded = true) Map<String, Object> query) {
      return null;
    }
  }

  Map<String, Object> params = new LinkedHashMap<>();
  params.put("kit", "k%20t");
  params.put("pi%20ng", "p%20g");

  Request request = buildRequest(Example.class, params);
  assertThat(request.method()).isEqualTo("GET");
  assertThat(request.headers().size()).isZero();
  assertThat(request.url().toString()).isEqualTo("http://example.com/foo/bar/?kit=k%20t&pi%20ng=p%20g");
  assertThat(request.body()).isNull();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:19,代碼來源:RequestBuilderTest.java

示例2: getWithPathAndQueryHashParam

import retrofit2.http.GET; //導入依賴的package包/類
@Test public void getWithPathAndQueryHashParam() {
  class Example {
    @GET("/foo/bar/{ping}/") //
    Call<ResponseBody> method(@Path("ping") String ping, @Query("kit") String kit) {
      return null;
    }
  }

  Request request = buildRequest(Example.class, "pong#", "kat#");
  assertThat(request.method()).isEqualTo("GET");
  assertThat(request.headers().size()).isZero();
  assertThat(request.url().toString()).isEqualTo("http://example.com/foo/bar/pong%23/?kit=kat%23");
  assertThat(request.body()).isNull();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:RequestBuilderTest.java

示例3: getWithJavaUriUrlAbsolute

import retrofit2.http.GET; //導入依賴的package包/類
@Test public void getWithJavaUriUrlAbsolute() {
  class Example {
    @GET
    Call<ResponseBody> method(@Url URI url) {
      return null;
    }
  }

  Request request = buildRequest(Example.class, URI.create("https://example2.com/foo/bar/"));
  assertThat(request.method()).isEqualTo("GET");
  assertThat(request.headers().size()).isZero();
  assertThat(request.url().toString()).isEqualTo("https://example2.com/foo/bar/");
  assertThat(request.body()).isNull();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:15,代碼來源:RequestBuilderTest.java

示例4: getWeather

import retrofit2.http.GET; //導入依賴的package包/類
@GET("forecast.json")
Observable<Weather> getWeather(
        @Query("key") String key,
        @Query("q") String city
);
 
開發者ID:irontec,項目名稱:rxweather-android,代碼行數:6,代碼來源:RxWeatherService.java

示例5: requestCharacterInventory

import retrofit2.http.GET; //導入依賴的package包/類
@Headers("X-API-KEY: " + apiKey)
@GET("/Platform/Destiny/{membershipType}/Account/{membershipId}/Character/{characterId}/Inventory")
Call<BungieResponse<DataResponse<CharacterInventory>>> requestCharacterInventory(@Path("membershipType") int membershipType,
                                                                                 @Path("membershipId") String membershipId,
                                                                                 @Path("characterId") String characterId,
                                                                                 @Header("Cookie") String cookie,
                                                                                 @Header("X-CSRF") String xcsrf);
 
開發者ID:jam01,項目名稱:LittleLight,代碼行數:8,代碼來源:RetrofitDestinyApiFacade.java

示例6: get

import retrofit2.http.GET; //導入依賴的package包/類
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.scheduler.Jobs get" })
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}")
Observable<Response<ResponseBody>> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("jobCollectionName") String jobCollectionName, @Path("jobName") String jobName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
開發者ID:Azure,項目名稱:azure-libraries-for-java,代碼行數:4,代碼來源:JobsInner.java

示例7: listByResourceGroupNext

import retrofit2.http.GET; //導入依賴的package包/類
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.relay.Namespaces listByResourceGroupNext" })
@GET
Observable<Response<ResponseBody>> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
開發者ID:Azure,項目名稱:azure-libraries-for-java,代碼行數:4,代碼來源:NamespacesInner.java

示例8: torrentSearch

import retrofit2.http.GET; //導入依賴的package包/類
@GET("ajax.php?action=browse")
Single<TorrentSearch> torrentSearch(@Query("searchstr") String search);
 
開發者ID:stuxo,項目名稱:REDAndroid,代碼行數:3,代碼來源:ApiService.java

示例9: get

import retrofit2.http.GET; //導入依賴的package包/類
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.RecommendedElasticPools get" })
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}")
Observable<Response<ResponseBody>> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("recommendedElasticPoolName") String recommendedElasticPoolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
開發者ID:Azure,項目名稱:azure-libraries-for-java,代碼行數:4,代碼來源:RecommendedElasticPoolsInner.java

示例10: getRelease

import retrofit2.http.GET; //導入依賴的package包/類
@NonNull @GET("repos/{owner}/{repo}/releases/{id}")
@Headers("Accept: application/vnd.github.VERSION.full+json")
Single<Release> getRelease(@Path("owner") String owner, @Path("repo") String repo, @Path("id") long id);
 
開發者ID:duyp,項目名稱:mvvm-template,代碼行數:4,代碼來源:RepoService.java

示例11: listMultiRolePoolSkus

import retrofit2.http.GET; //導入依賴的package包/類
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appservice.AppServiceEnvironments listMultiRolePoolSkus" })
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/skus")
Observable<Response<ResponseBody>> listMultiRolePoolSkus(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
開發者ID:Azure,項目名稱:azure-libraries-for-java,代碼行數:4,代碼來源:AppServiceEnvironmentsInner.java

示例12: listByResourceGroupNext

import retrofit2.http.GET; //導入依賴的package包/類
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.VirtualMachineScaleSets listByResourceGroupNext" })
@GET
Observable<Response<ResponseBody>> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
開發者ID:Azure,項目名稱:azure-libraries-for-java,代碼行數:4,代碼來源:VirtualMachineScaleSetsInner.java

示例13: getTrendingLanguages

import retrofit2.http.GET; //導入依賴的package包/類
/**
 * get trending languages, update every day
 */
@Headers("Cache-Control: public, max-age=86400")
@NonNull @GET("languages")
Observable<Response<ArrayList<TrendingLanguage>>> getTrendingLanguages();
 
開發者ID:ThirtyDegreesRay,項目名稱:OpenHub,代碼行數:7,代碼來源:OpenHubService.java

示例14: listPremierAddOnOffers

import retrofit2.http.GET; //導入依賴的package包/類
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appservice.WebSiteManagementClient listPremierAddOnOffers" })
@GET("subscriptions/{subscriptionId}/providers/Microsoft.Web/premieraddonoffers")
Observable<Response<ResponseBody>> listPremierAddOnOffers(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
開發者ID:Azure,項目名稱:azure-libraries-for-java,代碼行數:4,代碼來源:WebSiteManagementClientImpl.java

示例15: getBeforeFreshNewsPosts

import retrofit2.http.GET; //導入依賴的package包/類
@GET("/")
Observable<FreshNewsPosts> getBeforeFreshNewsPosts(@Query("oxwlxojflwblxbsapi") String api,
                                                   @Query("include") String inclue,
                                                   @Query("custom_fields") String custom_fields,
                                                   @Query("dev") int dev,
                                                   @Query("page") int page);
 
開發者ID:Gookler,項目名稱:RxJanDan,代碼行數:7,代碼來源:ApiService.java


注:本文中的retrofit2.http.GET類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。