• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java OPTIONS类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ListenerService类代码示例发布时间:2022-05-22
下一篇:
Java UsernamePasswordCredential类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap