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


Java POST类代码示例

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


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

示例1: multipartPartMapSupportsSubclasses

import retrofit2.http.POST; //导入依赖的package包/类
@Test public void multipartPartMapSupportsSubclasses() throws IOException {
  class Foo extends HashMap<String, String> {
  }

  class Example {
    @Multipart //
    @POST("/foo/bar/") //
    Call<ResponseBody> method(@PartMap Foo parts) {
      return null;
    }
  }

  Foo foo = new Foo();
  foo.put("hello", "world");

  Request request = buildRequest(Example.class, foo);
  Buffer buffer = new Buffer();
  request.body().writeTo(buffer);
  assertThat(buffer.readUtf8())
      .contains("name=\"hello\"")
      .contains("\r\n\r\nworld\r\n--");
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:RequestBuilderTest.java

示例2: fieldMapRejectsNullKeys

import retrofit2.http.POST; //导入依赖的package包/类
@Test public void fieldMapRejectsNullKeys() {
  class Example {
    @FormUrlEncoded //
    @POST("/") //
    Call<ResponseBody> method(@FieldMap Map<String, Object> a) {
      return null;
    }
  }

  Map<String, Object> fieldMap = new LinkedHashMap<>();
  fieldMap.put("kit", "kat");
  fieldMap.put(null, "pong");

  try {
    buildRequest(Example.class, fieldMap);
    fail();
  } catch (IllegalArgumentException e) {
    assertThat(e).hasMessage("Field map contained null key.");
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:RequestBuilderTest.java

示例3: directLogin

import retrofit2.http.POST; //导入依赖的package包/类
@FormUrlEncoded
@POST("token")
Single<LoginResponse> directLogin(@Field("grant_type") String grantType,
                                  @Field("client_id") int clientId,
                                  @Field("client_secret") String clientSecret,
                                  @Field("username") String username,
                                  @Field("password") String password,
                                  @Field("v") String v,
                                  @Field("2fa_supported") int twoFaSupported,
                                  @Field("scope") String scope,
                                  @Field("code") String smscode,
                                  @Field("captcha_sid") String captchaSid,
                                  @Field("captcha_key") String captchaKey,
                                  @Field("force_sms") Integer forceSms);
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:15,代码来源:IAuthService.java

示例4: search

import retrofit2.http.POST; //导入依赖的package包/类
@FormUrlEncoded
@POST("users.search")
Single<BaseResponse<Items<VKApiUser>>> search(@Field("q") String query,
                                              @Field("sort") Integer sort,
                                              @Field("offset") Integer offset,
                                              @Field("count") Integer count,
                                              @Field("fields") String fields,
                                              @Field("city") Integer city,
                                              @Field("country") Integer country,
                                              @Field("hometown") String hometown,
                                              @Field("university_country") Integer universityCountry,
                                              @Field("university") Integer university,
                                              @Field("university_year") Integer universityYear,
                                              @Field("university_faculty") Integer universityFaculty,
                                              @Field("university_chair") Integer universityChair,
                                              @Field("sex") Integer sex,
                                              @Field("status") Integer status,
                                              @Field("age_from") Integer ageFrom,
                                              @Field("age_to") Integer ageTo,
                                              @Field("birth_day") Integer birthDay,
                                              @Field("birth_month") Integer birthMonth,
                                              @Field("birth_year") Integer birthYear,
                                              @Field("online") Integer online,
                                              @Field("has_photo") Integer hasPhoto,
                                              @Field("school_country") Integer schoolCountry,
                                              @Field("school_city") Integer schoolCity,
                                              @Field("school_class") Integer schoolClass,
                                              @Field("school") Integer school,
                                              @Field("school_year") Integer schoolYear,
                                              @Field("religion") String religion,
                                              @Field("interests") String interests,
                                              @Field("company") String company,
                                              @Field("position") String position,
                                              @Field("group_id") Integer groupId,
                                              @Field("from_list") String fromList);
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:36,代码来源:IUsersService.java

示例5: bodyRequired

import retrofit2.http.POST; //导入依赖的package包/类
@Test public void bodyRequired() {
  class Example {
    @POST("/foo/bar/") //
    Call<ResponseBody> method(@Body RequestBody body) {
      return null;
    }
  }
  try {
    buildRequest(Example.class, new Object[] { null });
    fail();
  } catch (IllegalArgumentException e) {
    assertThat(e.getMessage()).isEqualTo("Body parameter value must not be null.");
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:RequestBuilderTest.java

示例6: downloadFile

import retrofit2.http.POST; //导入依赖的package包/类
@Streaming
@POST
Call<ResponseBody> downloadFile(@Url String fileUrl);
 
开发者ID:yzzslow0,项目名称:Ec2m,代码行数:4,代码来源:RetrofitService.java

示例7: postRaw

import retrofit2.http.POST; //导入依赖的package包/类
@POST
Call<String> postRaw(@Url String url, @Body RequestBody body);
 
开发者ID:wang2016215,项目名称:Bing,代码行数:3,代码来源:RestService.java

示例8: implicitFormEncodingByFieldForbidden

import retrofit2.http.POST; //导入依赖的package包/类
@Test public void implicitFormEncodingByFieldForbidden() {
  class Example {
    @POST("/") //
    Call<ResponseBody> method(@Field("a") int a) {
      return null;
    }
  }
  try {
    buildRequest(Example.class);
    fail();
  } catch (IllegalArgumentException e) {
    assertThat(e).hasMessage(
        "@Field parameters can only be used with form encoding. (parameter #1)\n    for method Example.method");
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:RequestBuilderTest.java

示例9: alipayCheck

import retrofit2.http.POST; //导入依赖的package包/类
/**
 * 充值同步回调
 */
@Headers({HEADER_API_VERSION})
@FormUrlEncoded
@POST("payment/verifyResult")
Observable<BaseJson<JsonObject>> alipayCheck(@Field("_input_charset") String _input_charset, @Field("body") String body,
                                             @Field("currency") String currency, @Field("forex_biz") String forex_biz, @Field("notify_id") String notify_id, @Field("notify_time")
                                                     String notify_time, @Field("notify_type") String notify_type, @Field("notify_url") String notify_url, @Field("out_trade_no") String out_trade_no,
                                             @Field("partner") String partner, @Field("payment_type") String payment_type, @Field("return_url") String return_url, @Field("rmb_fee") String rmb_fee,
                                             @Field("seller_id") String seller_id, @Field("service") String service, @Field("sign") String sign, @Field("sign_type") String sign_type, @Field("subject")
                                                     String subject, @Field("success") String success, @Field("trade_no") String trade_no, @Field("trade_status") String trade_status);
 
开发者ID:Zyj163,项目名称:yyox,代码行数:13,代码来源:UserService.java

示例10: formEncodedFieldOptional

import retrofit2.http.POST; //导入依赖的package包/类
@Test public void formEncodedFieldOptional() {
  class Example {
    @FormUrlEncoded //
    @POST("/foo") //
    Call<ResponseBody> method(@Field("foo") String foo, @Field("ping") String ping,
        @Field("kit") String kit) {
      return null;
    }
  }
  Request request = buildRequest(Example.class, "bar", null, "kat");
  assertBody(request.body(), "foo=bar&kit=kat");
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:RequestBuilderTest.java

示例11: formEncodingFailsWithNoParts

import retrofit2.http.POST; //导入依赖的package包/类
@Test public void formEncodingFailsWithNoParts() {
  class Example {
    @FormUrlEncoded //
    @POST("/") //
    Call<ResponseBody> method() {
      return null;
    }
  }
  try {
    buildRequest(Example.class);
    fail();
  } catch (IllegalArgumentException e) {
    assertThat(e).hasMessage("Form-encoded method must contain at least one @Field.\n    for method Example.method");
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:RequestBuilderTest.java

示例12: setOnlineState

import retrofit2.http.POST; //导入依赖的package包/类
/**
 * 附近 模块 api
 */

//附近的人 改变在线状态
@Multipart
@POST("api.php?m=member&a=userStatus")
Observable<HttpResult<String>> setOnlineState(@Part("userid") String userid,
                                              @Part("type") String type);
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:10,代码来源:ApiService.java

示例13: wanted

import retrofit2.http.POST; //导入依赖的package包/类
@FormUrlEncoded
@POST("wanted") Observable<ResponseModel_no_list> wanted(@Field("productName") String productName
        , @Field("price") String price
        , @Field("num") String num
        , @Field("userAddress.addressId") String addressId
        , @Field("deliveryTime") int deliveryTime
        , @Field("pack") int pack
        , @Field("deliveryArea") String deliveryArea
        , @Field("requirements") String requirements
        , @Field("picture") String picture
        , @Field("total") Double total
        , @Field("createType") String createType
);
 
开发者ID:linsir6,项目名称:TripBuyer,代码行数:14,代码来源:Api.java

示例14: exchangeAward

import retrofit2.http.POST; //导入依赖的package包/类
@POST("/awards/{award_auth_token}/exchange")
Call<RewardContainer> exchangeAward(@Header("Authorization") String authToken,
        @Path("award_auth_token") String authTokenAward);
 
开发者ID:ArnauBlanch,项目名称:civify-app,代码行数:4,代码来源:AwardService.java

示例15: createTask

import retrofit2.http.POST; //导入依赖的package包/类
@POST("/saveInfo")
Call<User> createTask(@Body User task);
 
开发者ID:attiqrehman1991,项目名称:AndroidRepositoryWithOfflineMode,代码行数:3,代码来源:RetrofitLoginServices.java


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