當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。