Retrofit2+Rxjava2 okhttp RxBus 使用记录
2017-06-23 15:30
585 查看
学习 博客 http://blog.csdn.net/r17171709/article/details/51149350
@Query 后面跟要添加的字段
[b]@Path 连接url里面{userId} @Path("userId") String userId[/b]
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/
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
[b]RxBus[/b]
[b]http://www.jianshu.com/p/7f4a709d2be5[/b]
[b]http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/subjects/PublishSubject.html[/b]
io.reactivex.subjects
io.reactivex.Observable<T>
io.reactivex.subjects.Subject<T>
io.reactivex.subjects.PublishSubject<T>
Type Parameters:
![](https://images2015.cnblogs.com/blog/568543/201707/568543-20170701151722993-1034463283.png)
http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/subjects/BehaviorSubject.html
io.reactivex.subjects
io.reactivex.Observable<T>
io.reactivex.subjects.Subject<T>
io.reactivex.subjects.BehaviorSubject<T>
Type Parameters:
![](https://images2015.cnblogs.com/blog/568543/201707/568543-20170701151917993-774122407.png)
[b]http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/subjects/ReplaySubject.html[/b]
io.reactivex.subjects
io.reactivex.Observable<T>
io.reactivex.subjects.Subject<T>
io.reactivex.subjects.ReplaySubject<T>
Type Parameters:
![](https://images2015.cnblogs.com/blog/568543/201707/568543-20170701151411883-595126971.png)
@Query 后面跟要添加的字段
[b]@Path 连接url里面{userId} @Path("userId") String userId[/b]
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
[b]RxBus[/b]
[b]http://www.jianshu.com/p/7f4a709d2be5[/b]
[b]http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/subjects/PublishSubject.html[/b]
io.reactivex.subjects
Class PublishSubject<T>
java.lang.Objectio.reactivex.Observable<T>
io.reactivex.subjects.Subject<T>
io.reactivex.subjects.PublishSubject<T>
Type Parameters:
T- the type of items observed and emitted by the SubjectAll Implemented Interfaces:ObservableSource<T>, Observer<T>
![](https://images2015.cnblogs.com/blog/568543/201707/568543-20170701151722993-1034463283.png)
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>
java.lang.Objectio.reactivex.Observable<T>
io.reactivex.subjects.Subject<T>
io.reactivex.subjects.BehaviorSubject<T>
Type Parameters:
T- the type of item expected to be observed by the SubjectAll Implemented Interfaces:ObservableSource<T>, Observer<T>
![](https://images2015.cnblogs.com/blog/568543/201707/568543-20170701151917993-774122407.png)
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);
[b]http://reactivex.io/RxJava/2.x/javadoc/io/reactivex/subjects/ReplaySubject.html[/b]
io.reactivex.subjects
Class ReplaySubject<T>
java.lang.Objectio.reactivex.Observable<T>
io.reactivex.subjects.Subject<T>
io.reactivex.subjects.ReplaySubject<T>
Type Parameters:
T- the value typeAll Implemented Interfaces:ObservableSource<T>, Observer<T>
![](https://images2015.cnblogs.com/blog/568543/201707/568543-20170701151411883-595126971.png)
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);
相关文章推荐
- Rxjava2使用-构建事件总线(RxBus)代替原生广播
- 学会Retrofit+OkHttp+RxAndroid三剑客的使用,让自己紧跟Android潮流的步伐
- 基于RxJava2后的RxBus的快速使用
- Retrofit+RxJava+OKhttp+RxBus
- Retrofit2、okHttp3、RxAndroid使用
- Android中的Retrofit+OkHttp+RxJava缓存架构使用
- Retrofit与RxAndroid结合使用
- RxAndroid使用入门记录
- 使用 Retrofit 和 okhttp 强制缓存失效问题
- OkHttp,Retrofit 1.x - 2.x 基本使用
- Retrofit 2.0 + OkHttp 3.0学习记录
- RxVolley使用文档 —— RxVolley = Volley + RxJava + OkHttp
- Retrofit使用OkHttp保存和添加cookie
- 基于Retrofit+Okio+RxBus实现文件下载(带下载进度)
- RxJava+RxBus的使用
- Retrofit2 使用记录
- Android RxJava/RxAndroid结合Retrofit使用
- Android应用架构之Retrofit、RxAndroid使用
- 关于okhttp和retrofit的使用的疑问
- retrofit 2.0 +RxAndroid 使用中遇到异常 【abstract method not implemented】