当前位置: 首页>>代码示例>>Java>>正文


Java HeaderMap类代码示例

本文整理汇总了Java中retrofit2.http.HeaderMap的典型用法代码示例。如果您正苦于以下问题:Java HeaderMap类的具体用法?Java HeaderMap怎么用?Java HeaderMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HeaderMap类属于retrofit2.http包,在下文中一共展示了HeaderMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: headerMapMustBeAMap

import retrofit2.http.HeaderMap; //导入依赖的package包/类
@Test public void headerMapMustBeAMap() {
  class Example {
    @GET("/")
    Call<ResponseBody> method(@HeaderMap List<String> headers) {
      return null;
    }
  }
  try {
    buildRequest(Example.class);
    fail();
  } catch (IllegalArgumentException e) {
    assertThat(e).hasMessage(
        "@HeaderMap parameter type must be Map. (parameter #1)\n    for method Example.method");
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:RequestBuilderTest.java

示例2: headerMapRejectsNull

import retrofit2.http.HeaderMap; //导入依赖的package包/类
@Test public void headerMapRejectsNull() {
  class Example {
    @GET("/")
    Call<ResponseBody> method(@HeaderMap Map<String, String> headers) {
      return null;
    }
  }

  try {
    buildRequest(Example.class, (Map<String, String>) null);
    fail();
  } catch (IllegalArgumentException e) {
    assertThat(e).hasMessage("Header map was null.");
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:RequestBuilderTest.java

示例3: executeUpload

import retrofit2.http.HeaderMap; //导入依赖的package包/类
/**
 * 上传文件
 * @param url
 * @param headerMap
 * @param paramPartList
 * @return
 */
@Multipart
@POST
Call<ResponseBody> executeUpload(
        @Url String url,
        @HeaderMap Map<String, String> headerMap,
        @Part() List<MultipartBody.Part> paramPartList
);
 
开发者ID:CodingCodersCode,项目名称:EvolvingNetLib,代码行数:15,代码来源:CCNetApiService.java

示例4: executeDownload

import retrofit2.http.HeaderMap; //导入依赖的package包/类
/**
 * 下载文件
 * @param url
 * @param headerMap
 * @param txtParamMap
 * @return
 */
@Streaming
@GET
Call<ResponseBody> executeDownload(
        @Url String url,
        @HeaderMap Map<String, String> headerMap,
        @QueryMap Map<String, String> txtParamMap
);
 
开发者ID:CodingCodersCode,项目名称:EvolvingNetLib,代码行数:15,代码来源:CCNetApiService.java

示例5: getAsync

import retrofit2.http.HeaderMap; //导入依赖的package包/类
public static <T> Call getAsync(String apiUrl, @HeaderMap Map<String, Object> headers, Map<String, Object> paramMap, final HttpResponse<T> httpResponse) {
    if (paramMap == null) {
        paramMap = new HashMap<>();
    }
    if (headers == null) {
        headers = new HashMap<>();
    }
    HttpService httpService = getInstance().mRetrofit.create(HttpService.class);
    Call<ResponseBody> call = httpService.get(apiUrl, headers, paramMap);
    parseNetData(call, httpResponse);
    return call;
}
 
开发者ID:yy941002,项目名称:retrofit-OurRetrofit,代码行数:13,代码来源:HttpUtil.java

示例6: postAsync

import retrofit2.http.HeaderMap; //导入依赖的package包/类
public static <T> Call postAsync(String apiUrl, @HeaderMap Map<String, Object> headers, Map<String, Object> paramMap, HttpResponse<T> httpResponse) {
    if (paramMap == null) {
        paramMap = new HashMap<>();
    }
    if (headers == null) {
        headers = new HashMap<>();
    }
    HttpService httpService = getInstance().mRetrofit.create(HttpService.class);
    Call<ResponseBody> call = httpService.post(apiUrl, headers, paramMap);

    parseNetData(call, httpResponse);
    return call;
}
 
开发者ID:yy941002,项目名称:retrofit-OurRetrofit,代码行数:14,代码来源:HttpUtil.java

示例7: submitFeedbackForm

import retrofit2.http.HeaderMap; //导入依赖的package包/类
@POST("applications/{id}/submit")
Call<ResponseBody> submitFeedbackForm(
        @HeaderMap final Map<String, String> httpHeaders,
        @Path("id") final int applicationId,
        @Query("key") final String key,
        @Query("email") final String email,
        @Query("message") final String message,
        @Query("name") final String userName,
        @Query("properties") final String propertiesJson,
        @Query("attachments[]") final String[] attachments);
 
开发者ID:rm3l,项目名称:maoni-doorbell,代码行数:11,代码来源:DoorbellService.java

示例8: uploadScreenshot

import retrofit2.http.HeaderMap; //导入依赖的package包/类
@Multipart
@POST("applications/{id}/upload")
Call<String[]> uploadScreenshot(
        @HeaderMap final Map<String, String> httpHeaders,
        @Path("id") final int applicationId,
        @Query("key") final String key,
        @Part("files[]\"; filename=\"screenshot.png\" ") final RequestBody filename);
 
开发者ID:rm3l,项目名称:maoni-doorbell,代码行数:8,代码来源:DoorbellService.java

示例9: uploadLogs

import retrofit2.http.HeaderMap; //导入依赖的package包/类
@Multipart
@POST("applications/{id}/upload")
Call<String[]> uploadLogs(
        @HeaderMap final Map<String, String> httpHeaders,
        @Path("id") final int applicationId,
        @Query("key") final String key,
        @Part("files[]\"; filename=\"logs.txt\" ") final RequestBody filename);
 
开发者ID:rm3l,项目名称:maoni-doorbell,代码行数:8,代码来源:DoorbellService.java

示例10: download

import retrofit2.http.HeaderMap; //导入依赖的package包/类
@Streaming
@GET
Call<ResponseBody> download(@Url String url, @HeaderMap Map<String,String> headerMap);
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:4,代码来源:ApiService.java

示例11: uploadS3

import retrofit2.http.HeaderMap; //导入依赖的package包/类
@PUT
Call<ResponseBody> uploadS3(
    @HeaderMap Map<String, String> headers,
    @Url String url,
    @Body RequestBody body);
 
开发者ID:filestack,项目名称:filestack-java,代码行数:6,代码来源:UploadService.java

示例12: login

import retrofit2.http.HeaderMap; //导入依赖的package包/类
@FormUrlEncoded
@POST("/login")
Observable<ResponseBody> login(@HeaderMap Map<String, String> csrfToken, @Field("username") String userName, @Field("password") String password);
 
开发者ID:hyb1996,项目名称:Auto.js,代码行数:4,代码来源:UserApi.java

示例13: register

import retrofit2.http.HeaderMap; //导入依赖的package包/类
@FormUrlEncoded
@POST("/register")
Observable<ResponseBody> register(@HeaderMap Map<String, String> csrfToken, @Field("email") String email,
                                  @Field("username") String userName, @Field("password") String password, @Field("password-confirm") String repeatPassword);
 
开发者ID:hyb1996,项目名称:Auto.js,代码行数:5,代码来源:UserApi.java

示例14: logout

import retrofit2.http.HeaderMap; //导入依赖的package包/类
@POST("/logout")
Observable<ResponseBody> logout(@HeaderMap Map<String, String> csrfToken);
 
开发者ID:hyb1996,项目名称:Auto.js,代码行数:3,代码来源:UserApi.java

示例15: get

import retrofit2.http.HeaderMap; //导入依赖的package包/类
@GET()
Call<String> get(@HeaderMap Map<String, String> headers, @Url String url, @QueryMap Map<String, String> params);
 
开发者ID:jingle1267,项目名称:AndroidRequest,代码行数:3,代码来源:RetrofitHttpService.java


注:本文中的retrofit2.http.HeaderMap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。