GithubHelp home page GithubHelp logo

hhy5277 / nohttp4okhttp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jijinchao2014/nohttp4okhttp

0.0 2.0 0.0 9.75 MB

OkHttp和NoHttp的无缝结合封装。OkHttp and NoHttp combine.

Home Page: http://blog.csdn.net/yanzhenjie1003/article/details/52439317

Java 100.00%

nohttp4okhttp's Introduction

NoHttp4OkHttp

本库是对NoHttp和OkHttp的扩展,用OkHttp作为NoHttp的底层。

本库只有3个类,代码只有30k,更加稳定易于维护,代码易读。

NoHttp开源地址:https://github.com/yanzhenjie/NoHttp

OkHttp开源地址:https://github.com/square/okhttp

严振杰的主页:www.yanzhenjie.com
严振杰的博客:blog.yanzhenjie.com

QQ技术群来:547839514,加群请一定阅读群行为规范

替换NoHttp底层为OkHttp的原理

首先大家应该阅读下我对NoHttp的源码分析:
http://blog.csdn.net/yanzhenjie1003/article/details/52413226

替换OkHttp为NoHttp底层的原理(本项目的原理):
http://blog.csdn.net/yanzhenjie1003/article/details/52439317

上了上面的文章后你会知道NoHttp的网络层是对外提供了一个接口IRestConnection,我们的OkHttp需要针对IRestCOnnection写一个实现类即可,具体教程请看上面第二篇博客。

如何引用

  • 使用Gradle远程依赖,推荐
compile 'com.yanzhenjie.nohttp:nohttp-okhttp:1.0.1'

Or Maven

<dependency>
  <groupId>com.yanzhenjie.nohttp</groupId>
  <artifactId>nohttp-okhttp</artifactId>
  <version>1.0.1</version>
  <type>pom</type>
</dependency>
  • 使用Jar,下载项目后导入jar文件夹中的所有jar包。

使用介绍

基本用法NoHttp的所有用法不变,需要注意的两个地方:

  1. 创建队列NoHttp的用法是NoHttp.newRequestQueue...,使用本库改为NoOkHttp.newRequestQueue...
  2. 原来的同步请求是NoHttp.startSyncRequest...,使用本库改为NoOkHttp.startSyncRequest...

如果还有不明白的可以看demo或者加QQ技术群来讨论:547839514。

其他创建请求等用法均不变,更多用法请参考NoHttp:https://github.com/yanzhenjie/NoHttp

#License

Copyright 2016 Yan Zhenjie

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

nohttp4okhttp's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.