Retrofit源码分析 (四. Retrofit 官网说明,Copy)
来源:互联网 发布:s7总决赛现场数据 编辑:程序博客网 时间:2024/05/17 21:47
使用retrofit官网
Introduction
Retrofit turns your HTTP API into a Java interface.
public interface GitHubService { @GET("users/{user}/repos") Call<List<Repo>> listRepos(@Path("user") String user);}
The Retrofit class generates an implementation of the GitHubService interface.
Retrofit retrofit = new Retrofit.Builder() .baseUrl("https://api.github.com") .addConverterFactory(GsonConverterFactory.create()) .build();
GitHubService service = retrofit.create(GitHubService.class);
Each Call from the created GitHubService can make a synchronous or asynchronous HTTP request to the remote webserver.
Call<List<Repo>> repos = service.listRepos("octocat");
Use annotations to describe the HTTP request:
URL parameter replacement and query parameter support
Object conversion to request body (e.g., JSON, protocol buffers)
Multipart request body and file upload
阅读全文
0 0
- Retrofit源码分析 (四. Retrofit 官网说明,Copy)
- Retrofit源码解析(四)---ServiceMethod相关分析
- Retrofit源码分析 (五. Retrofit 深入分析)
- Retrofit源码分析 (六. Retrofit 深入ParameterHandler及其他)
- Retrofit源码分析
- Retrofit源码分析
- Retrofit源码分析
- Retrofit源码简要分析
- Retrofit源码分析1
- Retrofit源码分析
- Retrofit 源码分析
- Retrofit源码分析
- Retrofit源码分析
- Retrofit 2.0源码分析
- Retrofit 源码分析
- Retrofit源码分析
- Retrofit的源码分析
- Retrofit 源码分析
- Python获取帮助详解
- C++ 零碎知识点集锦 一
- keepalive+nginx负载均衡
- WrapPanel
- 时间段重复校验-js
- Retrofit源码分析 (四. Retrofit 官网说明,Copy)
- Mysql时区问题
- 一直没搞清楚的数组sort方法传入一个function是怎么运行的
- 三、解决Springboot集成ActivitiModel提示输入密码的问题
- Gym
- Tomcat集群配置学习篇(MARK)
- javaweb基础之--Servlet
- EasyNVR H5无插件摄像机直播解决方案前端解析之:videojs初始化的一些样式处理
- C# ADO.NET动态数据的增删改查(第五天)