本文整理汇总了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;
}
}
示例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();
}
示例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");
}
}
示例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;
}
示例5: check
import retrofit2.http.HEAD; //导入依赖的package包/类
@HEAD
Observable<Response<Void>> check(@Url String url);
示例6: checkRangeByHead
import retrofit2.http.HEAD; //导入依赖的package包/类
@HEAD
Observable<Response<Void>> checkRangeByHead(@Header("Range") String range,
@Url String url);
示例7: checkFileByHead
import retrofit2.http.HEAD; //导入依赖的package包/类
@HEAD
Observable<Response<Void>> checkFileByHead(@Header("If-Modified-Since") String lastModify,
@Url String url);
示例8: head
import retrofit2.http.HEAD; //导入依赖的package包/类
@HEAD()
Observable<ResponseBody> head(@Url String url, @QueryMap Map<String, String> maps);
示例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);
示例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);
示例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);
示例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);
示例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);
示例14: getImageSize
import retrofit2.http.HEAD; //导入依赖的package包/类
@HEAD
Call<Void> getImageSize(@Url String imageUrl);
示例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);