本文整理匯總了Java中retrofit2.http.Url類的典型用法代碼示例。如果您正苦於以下問題:Java Url類的具體用法?Java Url怎麽用?Java Url使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Url類屬於retrofit2.http包,在下文中一共展示了Url類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getWithNonStringUrlThrows
import retrofit2.http.Url; //導入依賴的package包/類
@Test public void getWithNonStringUrlThrows() {
class Example {
@GET
Call<ResponseBody> method(@Url Object url) {
return null;
}
}
try {
buildRequest(Example.class, "foo/bar");
fail();
} catch (IllegalArgumentException e) {
assertThat(e).hasMessage(
"@Url must be okhttp3.HttpUrl, String, java.net.URI, or android.net.Uri type."
+ " (parameter #1)\n"
+ " for method Example.method");
}
}
示例2: getWithUrlAbsoluteSameHost
import retrofit2.http.Url; //導入依賴的package包/類
@Test public void getWithUrlAbsoluteSameHost() {
class Example {
@GET
Call<ResponseBody> method(@Url String url) {
return null;
}
}
Request request = buildRequest(Example.class, "http://example.com/foo/bar/");
assertThat(request.method()).isEqualTo("GET");
assertThat(request.headers().size()).isZero();
assertThat(request.url().toString()).isEqualTo("http://example.com/foo/bar/");
assertThat(request.body()).isNull();
}
示例3: listNext
import retrofit2.http.Url; //導入依賴的package包/類
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.dns.Zones listNext" })
@GET
Observable<Response<ResponseBody>> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
示例4: uploadFile
import retrofit2.http.Url; //導入依賴的package包/類
@Multipart
@POST()
Observable<ResponseBody> uploadFile(@Url String fileUrl,
@Part("description") RequestBody description, @Part("files") MultipartBody.Part file);
示例5: register
import retrofit2.http.Url; //導入依賴的package包/類
@POST
@Headers({"ContentType: application/json", "Authorization:" + Const.KEY})
Call<RegisterData> register(@Url String url, @Body RegisterBody body);
示例6: executeGet
import retrofit2.http.Url; //導入依賴的package包/類
@GET()
Observable<ResponseBody> executeGet(
@Url String url,
@QueryMap Map<String, Object> maps);
示例7: uploadFile
import retrofit2.http.Url; //導入依賴的package包/類
@Multipart
@POST
Observable<ResponseBody> uploadFile(@Url String url, @Part MultipartBody.Part file);
示例8: post
import retrofit2.http.Url; //導入依賴的package包/類
@FormUrlEncoded
@POST
Call<ResponseBody> post(@Url String url, @HeaderMap Map<String, String> headers, @FieldMap Map<String, Object> param);
示例9: listByAccountNext
import retrofit2.http.Url; //導入依賴的package包/類
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datalake.store.TrustedIdProviders listByAccountNext" })
@GET
Observable<Response<ResponseBody>> listByAccountNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
示例10: delete
import retrofit2.http.Url; //導入依賴的package包/類
@DELETE
Call<String> delete(@Url String url, @QueryMap WeakHashMap<String, Object> params);
示例11: getObjectsByObjectIdsNext
import retrofit2.http.Url; //導入依賴的package包/類
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.graphrbac.Objects getObjectsByObjectIdsNext" })
@GET
Observable<Response<ResponseBody>> getObjectsByObjectIdsNext(@Url String nextUrl, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
示例12: list1Next
import retrofit2.http.Url; //導入依賴的package包/類
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.Features list1Next" })
@GET
Observable<Response<ResponseBody>> list1Next(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
示例13: listAuthorizationRulesNext
import retrofit2.http.Url; //導入依賴的package包/類
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.relay.HybridConnections listAuthorizationRulesNext" })
@GET
Observable<Response<ResponseBody>> listAuthorizationRulesNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
示例14: options
import retrofit2.http.Url; //導入依賴的package包/類
@OPTIONS()
Observable<ResponseBody> options(@Url String url, @QueryMap Map<String, String> maps);
示例15: postForm
import retrofit2.http.Url; //導入依賴的package包/類
@FormUrlEncoded
@POST()
Flowable<ResponseBody> postForm(
@Url() String url,
@FieldMap Map<String, Object> maps);