当前位置: 首页>>代码示例>>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;未经允许,请勿转载。