本文整理汇总了Java中retrofit2.http.OPTIONS类的典型用法代码示例。如果您正苦于以下问题:Java OPTIONS类的具体用法?Java OPTIONS怎么用?Java OPTIONS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OPTIONS类属于retrofit2.http包,在下文中一共展示了OPTIONS类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: optionFirstPageStream
import retrofit2.http.OPTIONS; //导入依赖的package包/类
@Headers({
"Connection: keep-alive",
"Access-Control-Request-Method: GET",
"Origin: https://unsplash.com",
"User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.83 Safari/537.36",
"Access-Control-Request-Headers: authorization,stream-auth-type,x-stream-client",
"Accept: */*",
"Referer: https://unsplash.com/",
"Accept-Encoding: gzip, deflate, sdch, br",
"Accept-Language: zh-CN,zh;q=0.8,en;q=0.6"
})
@OPTIONS("api/v1.0/feed/notification/{numeric_id}/")
Call<ResponseBody> optionFirstPageStream(@Path("numeric_id") int numeric_id,
@Query("limit") int limit,
@Query("api_key") String api_key,
@Query("location") String location);
开发者ID:WangDaYeeeeee,项目名称:Mysplash,代码行数:17,代码来源:GetStreamApi.java
示例2: parseMethodAnnotation
import retrofit2.http.OPTIONS; //导入依赖的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
示例3: options
import retrofit2.http.OPTIONS; //导入依赖的package包/类
@Test public void options() {
class Example {
@OPTIONS("/foo/bar/") //
Call<ResponseBody> method() {
return null;
}
}
Request request = buildRequest(Example.class);
assertThat(request.method()).isEqualTo("OPTIONS");
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
示例4: optionNextPageStream
import retrofit2.http.OPTIONS; //导入依赖的package包/类
@Headers({
"Connection: keep-alive",
"Access-Control-Request-Method: GET",
"Origin: https://unsplash.com",
"User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.83 Safari/537.36",
"Access-Control-Request-Headers: authorization,stream-auth-type,x-stream-client",
"Accept: */*",
"Referer: https://unsplash.com/",
"Accept-Encoding: gzip, deflate, sdch, br",
"Accept-Language: zh-CN,zh;q=0.8,en;q=0.6"
})
@OPTIONS
Call<ResponseBody> optionNextPageStream(@Url String next_page);
开发者ID:WangDaYeeeeee,项目名称:Mysplash,代码行数:14,代码来源:GetStreamApi.java
示例5: options
import retrofit2.http.OPTIONS; //导入依赖的package包/类
@OPTIONS()
Observable<ResponseBody> options(@Url String url, @QueryMap Map<String, String> maps);
开发者ID:xiaoyaoyou1212,项目名称:XSnow,代码行数:3,代码来源:ApiService.java
示例6: executeOptions
import retrofit2.http.OPTIONS; //导入依赖的package包/类
/**
* 发起OPTIONS类型请求
*
* @param url
* @param headerMap
* @param paramMap
* @return
*/
@OPTIONS
Call<ResponseBody> executeOptions(
@Url String url,
@HeaderMap Map<String, String> headerMap,
@QueryMap Map<String, String> paramMap);
开发者ID:CodingCodersCode,项目名称:EvolvingNetLib,代码行数:14,代码来源:CCNetApiService.java
注:本文中的retrofit2.http.OPTIONS类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论