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


Java FormUrlEncoded类代码示例

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


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

示例1: formEncodingFailsOnNonBodyMethod

import retrofit2.http.FormUrlEncoded; //导入依赖的package包/类
@Test public void formEncodingFailsOnNonBodyMethod() {
  class Example {
    @FormUrlEncoded //
    @GET("/") //
    Call<ResponseBody> method() {
      return null;
    }
  }
  try {
    buildRequest(Example.class);
    fail();
  } catch (IllegalArgumentException e) {
    assertThat(e).hasMessage(
        "FormUrlEncoded can only be specified on HTTP methods with request body (e.g., @POST).\n    for method Example.method");
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:RequestBuilderTest.java

示例2: onlyOneEncodingIsAllowedFormEncodingFirst

import retrofit2.http.FormUrlEncoded; //导入依赖的package包/类
@Test public void onlyOneEncodingIsAllowedFormEncodingFirst() {
  class Example {
    @FormUrlEncoded //
    @Multipart //
    @POST("/") //
    Call<ResponseBody> method() {
      return null;
    }
  }
  try {
    buildRequest(Example.class);
    fail();
  } catch (IllegalArgumentException e) {
    assertThat(e).hasMessage(
        "Only one encoding annotation is allowed.\n    for method Example.method");
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:RequestBuilderTest.java

示例3: post

import retrofit2.http.FormUrlEncoded; //导入依赖的package包/类
@FormUrlEncoded
@POST("wall.post")
Single<BaseResponse<PostCreateResponse>> post(@Field("owner_id") Integer ownerId,
                                              @Field("friends_only") Integer friendsOnly,
                                              @Field("from_group") Integer fromGroup,
                                              @Field("message") String message,
                                              @Field("attachments") String attachments,
                                              @Field("services") String services,
                                              @Field("signed") Integer signed,
                                              @Field("publish_date") Long publishDate,
                                              @Field("lat") Double latitude,
                                              @Field("long") Double longitude,
                                              @Field("place_id") Integer placeId,
                                              @Field("post_id") Integer postId,
                                              @Field("guid") Integer guid,
                                              @Field("mark_as_ads") Integer markAsAds,
                                              @Field("ads_promoted_stealth") Integer adsPromotedStealth);
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:18,代码来源:IWallService.java

示例4: simpleFormEncoded

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

示例5: add

import retrofit2.http.FormUrlEncoded; //导入依赖的package包/类
@POST("order/new")
@FormUrlEncoded
Flowable<ResponseDto> add(
        @Field("deviceId") String deviceId,
        @Field("price") float price,
        @Field("adOwner") String adOwner,
        @Field("deviceOwner") String deviceOwner,
        @Field("token") String token
);
 
开发者ID:ruiqiao2017,项目名称:Renrentou,代码行数:10,代码来源:OrderService.java

示例6: editManager

import retrofit2.http.FormUrlEncoded; //导入依赖的package包/类
@FormUrlEncoded
@POST("groups.editManager")
Single<BaseResponse<Integer>> editManager(@Field("group_id") int groupId,
                                          @Field("user_id") int userId,
                                          @Field("role") String role,
                                          @Field("is_contact") Integer isContact,
                                          @Field("contact_position") String contactPosition,
                                          @Field("contact_phone") String contactPhone,
                                          @Field("contact_email") String contactEmail);
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:10,代码来源:IGroupsService.java

示例7: formEncodedWithEncodedNameFieldParam

import retrofit2.http.FormUrlEncoded; //导入依赖的package包/类
@Test public void formEncodedWithEncodedNameFieldParam() {
  class Example {
    @FormUrlEncoded //
    @POST("/foo") //
    Call<ResponseBody> method(@Field(value = "na%20me", encoded = true) String foo) {
      return null;
    }
  }
  Request request = buildRequest(Example.class, "ba%20r");
  assertBody(request.body(), "na%20me=ba%20r");
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:RequestBuilderTest.java

示例8: getAccessToken

import retrofit2.http.FormUrlEncoded; //导入依赖的package包/类
@POST
@FormUrlEncoded
Observable<Response<AccessToken>> getAccessToken(@Url String url,
                                                 @Field("client_id") String clientId,
                                                 @Field("client_secret") String clientSecret,
                                                 @Field("code") String code,
                                                 @Field("redirect_uri") String redirect_uri);
 
开发者ID:gejiaheng,项目名称:Protein,代码行数:8,代码来源:AccessTokenService.java

示例9: uploadMusic

import retrofit2.http.FormUrlEncoded; //导入依赖的package包/类
@FormUrlEncoded
@POST("upload/music")
Observable<UploadResponse> uploadMusic(@Field("name") String name,
                                       @Field("author") String author,
                                       @Field("authorID") Integer authorID,
                                       @Field("authorAvatarName") String authorAvatarName,
                                       @Field("date") String date,
                                       @Field("musicName") String musicName,
                                       @Field("imgName") String imgName,
                                       @Field("musicInfo") String musicInfo);
 
开发者ID:hgs1217,项目名称:Paper-Melody,代码行数:11,代码来源:SocialSystemAPI.java

示例10: search

import retrofit2.http.FormUrlEncoded; //导入依赖的package包/类
@FormUrlEncoded
@POST("audio.search")
Single<BaseResponse<Items<VKApiAudio>>> search(@Field("q") String query,
                                               @Field("auto_complete") Integer autoComplete,
                                               @Field("lyrics") Integer lyrics,
                                               @Field("performer_only") Integer performerOnly,
                                               @Field("sort") Integer sort,
                                               @Field("search_own") Integer searchOwn,
                                               @Field("offset") Integer offset,
                                               @Field("count") Integer count);
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:11,代码来源:IAudioService.java

示例11: getAccessToken

import retrofit2.http.FormUrlEncoded; //导入依赖的package包/类
@Headers({
        "Authorization:Basic ZnJvbnRlbmQ6",
        "Content-Type:application/x-www-form-urlencoded"
})
@FormUrlEncoded
@POST("login/oauth")
Call<AccessToken> getAccessToken(@Field("username") String username, @Field("password") String password, @Field("grant_type") String grant_type);
 
开发者ID:freeloki,项目名称:AndroidThings-BurglarAlarm,代码行数:8,代码来源:IgniteService.java

示例12: comment

import retrofit2.http.FormUrlEncoded; //导入依赖的package包/类
@POST("sys/comments/new")
@FormUrlEncoded
Flowable<ResponseDto> comment(
        @Field("account") String account,
        @Field("content") String content,
        @Field("token") String token
);
 
开发者ID:ruiqiao2017,项目名称:Renrentou,代码行数:8,代码来源:SystemService.java

示例13: getTvShows

import retrofit2.http.FormUrlEncoded; //导入依赖的package包/类
@POST("ajaxik.php")
@FormUrlEncoded
Observable<TvShowsResponse> getTvShows(@Field("act") String act,
                                       @Field("type") String type,
                                       @Field("o") int offset,
                                       @Field("s") int searchType,
                                       @Field("t") int t);
 
开发者ID:CrazyDude1994,项目名称:lostfilm-android-client,代码行数:8,代码来源:LostFilmService.java

示例14: updateAd

import retrofit2.http.FormUrlEncoded; //导入依赖的package包/类
@POST("order/update")
@FormUrlEncoded
Flowable<ResponseDto> updateAd(
        @Field("id") String id,
        @Field("adId") String adId,
        @Field("token") String token
);
 
开发者ID:ruiqiao2017,项目名称:Renrentou,代码行数:8,代码来源:OrderService.java

示例15: filterPkg

import retrofit2.http.FormUrlEncoded; //导入依赖的package包/类
/**
 * { "status": 0, "msg": "success" }
 */
@FormUrlEncoded
@POST("reqfilter/{iconpack}/{user}")
Call<ResResBean> filterPkg(@Path("iconpack") String iconPack,
                           @Path("user") String user,
                           @Field("pkg") String pkgName,
                           @Field("launcher") String launcherActivity);
 
开发者ID:homeii,项目名称:GxIconAndroid,代码行数:10,代码来源:NanoServerService.java


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