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


Java HEAD类代码示例

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


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

示例1: parseMethodAnnotation

import retrofit2.http.HEAD; //导入依赖的package包/类
private void parseMethodAnnotation(Annotation annotation) {
  if (annotation instanceof DELETE) {
    parseHttpMethodAndPath("DELETE", ((DELETE) annotation).value(), false);
  } else if (annotation instanceof GET) {
    parseHttpMethodAndPath("GET", ((GET) annotation).value(), false);
  } else if (annotation instanceof HEAD) {
    parseHttpMethodAndPath("HEAD", ((HEAD) annotation).value(), false);
    if (!Void.class.equals(responseType)) {
      throw methodError("HEAD method must use Void as response type.");
    }
  } else if (annotation instanceof PATCH) {
    parseHttpMethodAndPath("PATCH", ((PATCH) annotation).value(), true);
  } else if (annotation instanceof POST) {
    parseHttpMethodAndPath("POST", ((POST) annotation).value(), true);
  } else if (annotation instanceof PUT) {
    parseHttpMethodAndPath("PUT", ((PUT) annotation).value(), true);
  } else if (annotation instanceof OPTIONS) {
    parseHttpMethodAndPath("OPTIONS", ((OPTIONS) annotation).value(), false);
  } else if (annotation instanceof HTTP) {
    HTTP http = (HTTP) annotation;
    parseHttpMethodAndPath(http.method(), http.path(), http.hasBody());
  } else if (annotation instanceof retrofit2.http.Headers) {
    String[] headersToParse = ((retrofit2.http.Headers) annotation).value();
    if (headersToParse.length == 0) {
      throw methodError("@Headers annotation is empty.");
    }
    headers = parseHeaders(headersToParse);
  } else if (annotation instanceof Multipart) {
    if (isFormEncoded) {
      throw methodError("Only one encoding annotation is allowed.");
    }
    isMultipart = true;
  } else if (annotation instanceof FormUrlEncoded) {
    if (isMultipart) {
      throw methodError("Only one encoding annotation is allowed.");
    }
    isFormEncoded = true;
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:40,代码来源:ServiceMethod.java

示例2: head

import retrofit2.http.HEAD; //导入依赖的package包/类
@Test public void head() {
  class Example {
    @HEAD("/foo/bar/") //
    Call<Void> method() {
      return null;
    }
  }
  Request request = buildRequest(Example.class);
  assertThat(request.method()).isEqualTo("HEAD");
  assertThat(request.headers().size()).isZero();
  assertThat(request.url().toString()).isEqualTo("http://example.com/foo/bar/");
  assertThat(request.body()).isNull();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:RequestBuilderTest.java

示例3: headWithoutVoidThrows

import retrofit2.http.HEAD; //导入依赖的package包/类
@Test public void headWithoutVoidThrows() {
  class Example {
    @HEAD("/foo/bar/") //
    Call<ResponseBody> method() {
      return null;
    }
  }
  try {
    buildRequest(Example.class);
  } catch (IllegalArgumentException e) {
    assertThat(e).hasMessage(
        "HEAD method must use Void as response type.\n    for method Example.method");
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:RequestBuilderTest.java

示例4: getSupportedAnnotationTypes

import retrofit2.http.HEAD; //导入依赖的package包/类
@Override
public Set<String> getSupportedAnnotationTypes() {
  Set<String> annotations = new LinkedHashSet<String>();
  annotations.add(GET.class.getCanonicalName());
  annotations.add(PUT.class.getCanonicalName());
  annotations.add(POST.class.getCanonicalName());
  annotations.add(DELETE.class.getCanonicalName());
  annotations.add(HEAD.class.getCanonicalName());
  return annotations;
}
 
开发者ID:kaif-open,项目名称:kaif-android,代码行数:11,代码来源:RetrofitServiceProcessor.java

示例5: check

import retrofit2.http.HEAD; //导入依赖的package包/类
@HEAD
Observable<Response<Void>> check(@Url String url);
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:3,代码来源:DownloadApi.java

示例6: checkRangeByHead

import retrofit2.http.HEAD; //导入依赖的package包/类
@HEAD
Observable<Response<Void>> checkRangeByHead(@Header("Range") String range,
                                            @Url String url);
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:DownloadApi.java

示例7: checkFileByHead

import retrofit2.http.HEAD; //导入依赖的package包/类
@HEAD
Observable<Response<Void>> checkFileByHead(@Header("If-Modified-Since") String lastModify,
                                           @Url String url);
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:DownloadApi.java

示例8: head

import retrofit2.http.HEAD; //导入依赖的package包/类
@HEAD()
Observable<ResponseBody> head(@Url String url, @QueryMap Map<String, String> maps);
 
开发者ID:xiaoyaoyou1212,项目名称:XSnow,代码行数:3,代码来源:ApiService.java

示例9: checkExistence

import retrofit2.http.HEAD; //导入依赖的package包/类
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.Resources checkExistence" })
@HEAD("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}")
Observable<Response<Void>> checkExistence(@Path("resourceGroupName") String resourceGroupName, @Path("resourceProviderNamespace") String resourceProviderNamespace, @Path(value = "parentResourcePath", encoded = true) String parentResourcePath, @Path(value = "resourceType", encoded = true) String resourceType, @Path("resourceName") String resourceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:4,代码来源:ResourcesInner.java

示例10: checkExistenceById

import retrofit2.http.HEAD; //导入依赖的package包/类
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.Resources checkExistenceById" })
@HEAD("{resourceId}")
Observable<Response<Void>> checkExistenceById(@Path(value = "resourceId", encoded = true) String resourceId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:4,代码来源:ResourcesInner.java

示例11: checkExistence

import retrofit2.http.HEAD; //导入依赖的package包/类
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.Deployments checkExistence" })
@HEAD("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}")
Observable<Response<Void>> checkExistence(@Path("resourceGroupName") String resourceGroupName, @Path("deploymentName") String deploymentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:4,代码来源:DeploymentsInner.java

示例12: checkExistence

import retrofit2.http.HEAD; //导入依赖的package包/类
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.ResourceGroups checkExistence" })
@HEAD("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}")
Observable<Response<Void>> checkExistence(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:4,代码来源:ResourceGroupsInner.java

示例13: checkNameExists

import retrofit2.http.HEAD; //导入依赖的package包/类
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.DatabaseAccounts checkNameExists" })
@HEAD("providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}")
Observable<Response<Void>> checkNameExists(@Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:4,代码来源:DatabaseAccountsInner.java

示例14: getImageSize

import retrofit2.http.HEAD; //导入依赖的package包/类
@HEAD
Call<Void> getImageSize(@Url String imageUrl);
 
开发者ID:Tenor-Inc,项目名称:tenor-android-core,代码行数:3,代码来源:IApiClient.java

示例15: customNamedRequestIdHead

import retrofit2.http.HEAD; //导入依赖的package包/类
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.azurespecials.Headers customNamedRequestIdHead" })
@HEAD("azurespecials/customNamedRequestIdHead")
Observable<Response<Void>> customNamedRequestIdHead(@Header("foo-client-request-id") String fooClientRequestId, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
开发者ID:Azure,项目名称:autorest.java,代码行数:4,代码来源:HeadersInner.java


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