Retrofit 2.0.0 正式发布,Android 的 REST 客户端

淡漠悠然
 淡漠悠然
发布于 2016年03月12日
收藏 17

Retrofit 2.0.0 正式发布了,retrofit 是一个类型安全的 REST 客户端,用于 Android 平台。。

该版本的重点是提升扩展性,因此包含大量 API 的改动,与上一个版本不兼容。详细的变化请看这里

与 Beta4 版本比较的改进包括:

  • New: RxJavaCallAdapterFactory now supports service methods which return Completable which ignores and discards response bodies, if any.

  • New: RxJavaCallAdapterFactory supports supplying a default Scheduler which will be used for subscribeOn on returned Observable, Single, and Completable instances.

  • New: MoshiConverterFactory supports creating an instance which uses lenient parsing.

  • New: @Part can omit the part name and use OkHttp's MultipartBody.Part type for supplying parts. This lets you customize the headers, name, and filename and provide the part body in a single argument.

  • The BaseUrl interface and support for changeable base URLs was removed. This functionality can be done using an OkHttp interceptor and a sample showcasing it was added.

  • Response.isSuccess() was renamed to Response.isSuccessful() for parity with the name of OkHttp's version of that method.

  • Fix: Throw a more appropriate exception with a message when a resolved url (base URL + relative URL) is malformed.

  • Fix: GsonConverterFactory now honors settings on the Gson instance (like leniency).

  • Fix: ScalarsConverterFactory now supports primitive scalar types in addition to boxed for response body parsing.

  • Fix: Retrofit.callbackExecutor() may now return an executor even when one was not explicitly provided. This allows custom CallAdapter.Factory implementations to use it when triggering callbacks to ensure they happen on the appropriate thread for the platform (e.g., Android).

下载地址:

https://github.com/square/retrofit/releases/tag/parent-2.0.0

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处,尊重他人劳动共创开源社区。
转载请注明:文章转载自 OSCHINA 社区 [http://www.oschina.net]
本文标题:Retrofit 2.0.0 正式发布,Android 的 REST 客户端
加载中

最新评论(7

动弹
动弹
在用beta3, 感觉改动挺大的
大神小维
大神小维
好东西啊
打雷要下雨LEO
打雷要下雨LEO
好东西
luamas
luamas
终于正式发布了
北•野
北•野
帅气
hantsy
hantsy
Cool
翠翠
翠翠
好啊~~~
返回顶部
顶部