学习 博客 http://blog.csdn.net/r17171709/article/details/51149350

@Query 后面跟要添加的字段

@Path 连接url里面{userId}  @Path("userId") String userId

RxJava2 浅析

http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2016/0907/6604.html

RxJava2+Retrofit2网络框架封装

http://blog.csdn.net/gesanri/article/details/52701651

Log打印参数封装类

http://www.jianshu.com/p/2b0aeb6b6b61/

public static Retrofit create() {
OkHttpClient.Builder builder = new OkHttpClient().newBuilder();
builder.readTimeout(10, TimeUnit.SECONDS);
builder.connectTimeout(9, TimeUnit.SECONDS);
/**添加log注释**/
if (BuildConfig.DEBUG) {
      /***这里默认使用Log Debug模式打印**/
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
builder.addInterceptor(interceptor);
builder.addNetworkInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.HEADERS));
builder.addNetworkInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BASIC));
} return new Retrofit.Builder().baseUrl(SERVER_URL)
.client(builder.build())
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.build();
}

Retrofit网络安全的了解:
http://www.jianshu.com/p/16994e49e2f6

学习Https ssl证书,如何生成自签名的证书。
http://blog.csdn.net/u013424496/article/details/51161647

HTTPS 和 SSL 确保安全
https://developer.android.google.cn/training/articles/security-ssl.html

Retrofit2实现访问Https
http://blog.csdn.net/PengFFF/article/details/70682494

http://www.jianshu.com/p/16994e49e2f6

RxBus

http://www.jianshu.com/p/7f4a709d2be5

http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/subjects/PublishSubject.html

io.reactivex.subjects

Class PublishSubject<T>

  • Type Parameters:
    T - the type of items observed and emitted by the Subject
    All Implemented Interfaces:
    ObservableSource<T>, Observer<T>
    PublishSubject<Object> subject = PublishSubject.create();
    // observer1 will receive all onNext and onComplete events
    subject.subscribe(observer1);
    subject.onNext("one");
    subject.onNext("two");
    // observer2 will only receive "three" and onComplete
    subject.subscribe(observer2);
    subject.onNext("three");
    subject.onComplete();

    http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/subjects/BehaviorSubject.html

    io.reactivex.subjects

    Class BehaviorSubject<T>

    • Type Parameters:
      T - the type of item expected to be observed by the Subject
      All Implemented Interfaces:
      ObservableSource<T>, Observer<T>
      Example usage:
      
       // observer will receive all 4 events (including "default").
      BehaviorSubject<Object> subject = BehaviorSubject.createDefault("default");
      subject.subscribe(observer);
      subject.onNext("one");
      subject.onNext("two");
      subject.onNext("three"); // observer will receive the "one", "two" and "three" events, but not "zero"
      BehaviorSubject<Object> subject = BehaviorSubject.create();
      subject.onNext("zero");
      subject.onNext("one");
      subject.subscribe(observer);
      subject.onNext("two");
      subject.onNext("three"); // observer will receive only onComplete
      BehaviorSubject<Object> subject = BehaviorSubject.create();
      subject.onNext("zero");
      subject.onNext("one");
      subject.onComplete();
      subject.subscribe(observer); // observer will receive only onError
      BehaviorSubject<Object> subject = BehaviorSubject.create();
      subject.onNext("zero");
      subject.onNext("one");
      subject.onError(new RuntimeException("error"));
      subject.subscribe(observer);

http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/subjects/ReplaySubject.html

io.reactivex.subjects

Class ReplaySubject<T>

  • Type Parameters:
    T - the value type
    All Implemented Interfaces:
    ObservableSource<T>, Observer<T>
     ReplaySubject<Object> subject = new ReplaySubject<>();
    subject.onNext("one");
    subject.onNext("two");
    subject.onNext("three");
    subject.onComplete(); // both of the following will get the onNext/onComplete calls from above
    subject.subscribe(observer1);
    subject.subscribe(observer2);

Retrofit2+Rxjava2 okhttp RxBus 使用记录的更多相关文章

  1. Retrofit2+Rxjava+OkHttp的使用和网络请求

    Retrofit2+Rxjava+OkHttp的使用和网络请求 https://blog.csdn.net/huandroid/article/details/79883895 加入Rxjava 如果 ...

  2. Android 从零开始搭建一个主流项目框架—RxJava2.0+Retrofit2.0+OkHttp

    我这里的网络请求是用的装饰者模式去写的,什么是装饰者模式呢?在不必改变原类文件和使用继承的情况下,动态地扩展一个对象的功能.它是通过创建一个包装对象,也就是装饰来包裹真实的对象.我的理解就是一个接口, ...

  3. 使用Retrofit2+RxJava2+ProtoBuf实现网络请求

    引言 Retrofit 是一个用于 Android 和 Java 平台的类型安全的,底层使用OkHttp实现网络请求框架.Retrofit 通过将 API 抽象成 Java 接口而让我们连接到 RES ...

  4. Retrofit2.0+OkHttp设置统一的请求头(request headers)

    有时候要求Retrofit2的接口中每个都要增加上headers,又不想做重复的事情,可以使用这种方法来为每个request请求都设置上相同的请求头header. 修改请求头request heade ...

  5. Retrofit2+Rxjava2的用法

    近几年,Retrofit犹如燎原之火搬席卷了整个Android界.要是不懂Retrofit,简直不好意思出门... 由于近几个项目都没用到Retrofit,无奈只能业余时间自己撸一下,写的不好的地方, ...

  6. 浅谈Retrofit2+Rxjava2

    近几年,Retrofit犹如燎原之火搬席卷了整个Android界.要是不懂Retrofit,简直不好意思出门...由于近几个项目都没用到Retrofit,无奈只能业余时间自己撸一下,写的不好的地方,还 ...

  7. MVP实战心得—封装Retrofit2.0+RxAndroid+RxBus

    响应式编程框架,rxjava的扩展,很爽的链式编程 魅力在于对数据的处理,与线程切换的灵活性. 用来处理异步操作(Lambda表达式不会用.用Lambda表达式代码会更少,但不会的人会看不懂代码.不是 ...

  8. Retrofit2.0+OkHttp打印Request URL(请求地址参数)

    学习了Retrofit中的拦截器功能:实现日志中打印请求头内容 Retrofit 2+ 是基于OKHttp进行封装的,那么也就是说想进行请求拦截然后进行打印出来的话,就必须要从OkHttp进行入手. ...

  9. retrofit2+rxjava+okhttp网络请求实现

    第一步:添加依赖: compile 'io.reactivex:rxandroid:1.2.0' compile 'com.squareup.retrofit2:adapter-rxjava:2.1. ...

随机推荐

  1. Eclipse设置相同变量背景色高亮显示

    在Eclipse中,鼠标选中或者光标移动到java类的变量名时,相同变量会被标识显示(设置背景色高亮), 并且侧边滚动条会标出变量的位置, 查找变量十分方便. 1.相同变量标识高亮显示: Window ...

  2. gcc gdb调试 & 命令行带参 (一) ******

    用GDB调试程序 GDB概述———— GDB是GNU开源组织发布的一个强大的UNIX下的程序调试工具.或许,各位比较喜欢那种图形界面方式的,像VC.BCB等IDE的调试,但如果你是在UNIX平台下做软 ...

  3. nginx和apache最核心的区别在于apache是同步多进程模型,一个连接对应一个进程;nginx是异步的,多个连接(万级别)可以对应一个进程

    nginx和apache的一些优缺点比较,摘自网络,加自己的一些整理. nginx相对于apache的优点: 1.轻量级,同样是web 服务,比apache 占用更少的内存及资源 2.抗并发,ngin ...

  4. Ubuntu安装配置串口通讯工具minicom&&cutecom

    原帖地址:https://blog.csdn.net/gatieme/article/details/45310493 2017-04-07更新 发现新的工具gtkterm全名叫serial port ...

  5. javascript面向对象之Object.defineProperty(a,b,c)

    /* Object.defineProperty(a,b,c);介绍 a:需要属性设置的对象 b:需要设置的属性名,(键值) c:是一个用于描述属性值得json数据.这个json数据有configur ...

  6. OpenGL chapter4 基础变换

    math3d库有两个数据类型,能够表示一个三维或四维向量: M3DVector3f M3DVector4f 4.3 理解投影 正投影 : 正交变换 透视投影 : 透视变换 表4.1 OpenGL变换术 ...

  7. Hadoop2.0构成之HDFS2.0

    HDFS2.0之HA 主备NameNode: 1.主NameNode对外提供服务,备NameNode同步主NameNode元数据,以待切换: 2.主NameNode的信息发生变化后,会将信息写到共享数 ...

  8. 字符串,hash

    字符串1.有序的字符的集合,不可变2.s.swapcase() 大变小,小变大3.s.capitalize() 第一个大写4.s.casefold() 返回将字符串中所有大写字符转换为小写后生成的字符 ...

  9. Windows Storage Stack

  10. 「SHOI2015」自动刷题机

    /* 有理有据的二分答案 因为在过程中最多减到零 所以n越小显然就能刷更多的题 无解时就是无论如何也无法得到k , 这个特判一下即可 */ #include<cstdio> #includ ...