All Projects → ejlchina → Okhttps

ejlchina / Okhttps

Licence: apache-2.0
如艺术一般优雅,像 1、2、3 一样简单,前后端通用,轻量却强大的 HTTP 客户端(同时支持 WebSocket 与 Stomp 协议)

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Okhttps

Rx Mvp
RxJava2+Retrofit2+RxLifecycle2+OkHttp3 封装RHttp 使用MVP模式构建项目
Stars: ✭ 343 (+272.83%)
Mutual labels:  download, upload, okhttp
Easyhttp
Android 网络请求框架,简单易用,so easy
Stars: ✭ 423 (+359.78%)
Mutual labels:  download, okhttp
Httptransfertasks
Cross Platform HTTP Transfers for downloading and uploading (supports background operations)
Stars: ✭ 87 (-5.43%)
Mutual labels:  download, upload
Docker Jdownloader
JDownloader 2 Docker Image (Multiarch) - Passed 40M Downloads
Stars: ✭ 85 (-7.61%)
Mutual labels:  download, download-manager
Negibox
All in one downloader 全能下载器
Stars: ✭ 335 (+264.13%)
Mutual labels:  download, download-manager
Net
Android上强大的网络请求
Stars: ✭ 344 (+273.91%)
Mutual labels:  download, okhttp
Fast Android Networking
🚀 A Complete Fast Android Networking Library that also supports HTTP/2 🚀
Stars: ✭ 5,346 (+5710.87%)
Mutual labels:  download, okhttp
UniBorg
Pluggable Telegram bot and userbot based on Telethon
Stars: ✭ 196 (+113.04%)
Mutual labels:  download, upload
Transit
Easy file uploading and downloading for Laravel 5.
Stars: ✭ 5 (-94.57%)
Mutual labels:  download, upload
Casync
Content-Addressable Data Synchronization Tool
Stars: ✭ 890 (+867.39%)
Mutual labels:  download, upload
Flickrsync
A command line tool to synchronise, upload, download, pictures between the local file system and Flickr. Image hash signature of the picture is used to uniquely identify the image.
Stars: ✭ 14 (-84.78%)
Mutual labels:  download, upload
Godfs
A simple fast, easy use distributed file system written in go.
Stars: ✭ 256 (+178.26%)
Mutual labels:  download, upload
Easygo
基于Kotlin、OkHttp的声明式网络框架,像写HTML界面一样写网络调用代码
Stars: ✭ 40 (-56.52%)
Mutual labels:  download, okhttp
Kotlin Networking
Kotlin Networking - An elegant networking library written in Kotlin
Stars: ✭ 88 (-4.35%)
Mutual labels:  okhttp, okhttp3
kubefilebrowser
kubernetes container filebrowser and webshell
Stars: ✭ 23 (-75%)
Mutual labels:  download, upload
Downthemall
The DownThemAll! WebExtension
Stars: ✭ 512 (+456.52%)
Mutual labels:  download, download-manager
angular-material-datatransfer
A HTML5 datatransfer UI for handling upload and download of multiple simultaneous files.
Stars: ✭ 13 (-85.87%)
Mutual labels:  download, upload
PyroGramBot
pluggable Telegram Bot based on Pyrogram
Stars: ✭ 168 (+82.61%)
Mutual labels:  download, upload
Motrix
A full-featured download manager.
Stars: ✭ 29,357 (+31809.78%)
Mutual labels:  download, download-manager
Dropbox Stream
Upload & Download streams for Dropbox
Stars: ✭ 35 (-61.96%)
Mutual labels:  download, upload

logo

Maven Central License Troy.Zhou

文档

官网 https://okhttps.ejlchina.com/

为什么用

  OkHttps 是近期开源的对 OkHttp3 轻量封装的框架,它独创的异步预处理器,特色的标签,灵活的上传下载进度监听与过程控制功能,在轻松解决很多问题的同时,设计上也力求纯粹与优雅。

  • 超级优雅的 API 设计,且链式调用,让你顺滑到底!
  • BaseURL、URL占位符、HTTP 同步 异步、WebSocket,让你想干啥就干啥!
  • JSON、Xml 等自动封装与解析,且支持与任意格式的数据解析框架集成,想用啥就用啥!
  • 同步拦截器、异步预处理器、回调执行器、全局监听、回调阻断 等等,让你扩展无限功能!
  • 文件上传下载(过程控制、进度监听),上传下载如此简单!
  • 单方法回调,充分利用 Lambda 表达式,让你代码超级简洁!
  • 超级轻量,但性能卓越!

如何使用

如艺术一般优雅,像 1、2、3 一样简单

// 同步 HTTP
List<User> users = OkHttps.sync("/users") 
        .get()                          // GET请求
        .getBody()                      // 响应报文体
        .toList(User.class);            // 自动反序列化 List 

// 异步 HTTP
OkHttps.async("/users/1")
        .setOnResponse(res -> {
            // 自动反序列化 Bean 
            User user = res.getBody().toBean(User.class);
        })
        .get();                         // GET请求

// WebSocket
OkHttps.webSocket("/chat") 
        .setOnMessage((WebSocket ws, Message msg) -> {
            // 从服务器接收消息
            Chat chat = msg.toBean(Chat.class);
            // 向服务器发送消息
            ws.send(chat); 
        })
        .listen();                     // 启动监听

请求三部曲

第一步、确定请求方式

  • 同步 HTTP - sync 方法
  • 异步 HTTP - async 方法
  • WebSocket - webSocket 方法

第二步、构建请求任务

  • addXxxPara - 添加请求参数
  • setOnXxxx - 设置回调函数
  • tag - 添加标签
  • ...

第三步、调用请求方法

HTTP 请求方法:

  • get() - GET 请求
  • post() - POST 请求
  • put() - PUT 请求
  • delete() - DELETE 请求
  • ...

Websocket 方法:

  • listen() - 启动监听

任意网络请求,都遵循请求三部曲!

相关项目

项目 最新版本 描述
okhttps 3.0.1 OkHttps 核心模块
okhttps-fastjson 3.0.1 与 fastjson 集成
okhttps-gson 3.0.1 与 gson 集成
okhttps-jackson 3.0.1 与 jackson 集成
okhttps-stomp 3.0.1 超级轻量的 Stomp 客户端
okhttps-xml 3.0.1 XML 解析扩展
okhttps-parallel 2.5.1 同文件多任务并行下载

超详细教程,请查看:https://okhttps.ejlchina.com/

联系方式

  • 微信:
  • 由于近期交流群的二维码被爬,扫码入群方式已被关闭 库的使用上若有疑问,可先加微信【18556739726】(请备注 OkHttps)再入群交流
  • 邮箱:[email protected]

友情链接

[ Bean Searcher ] 轻量级数据库条件检索引擎,一行代码实现复杂条件列表检索!

[ Json Kit ] 超轻量级 JSON 门面工具,用法简单,不依赖具体实现,让业务代码与 Jackson、Gson、Fastjson 等解耦!

[ SA Token ] 一个 JavaWeb 轻量级权限认证框架,功能全面,上手简单

参与贡献

  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].