Retrofit parent-2.2.0 发布,一个类型安全的Java和Android 的REST客户端库

jopen 5年前
   <p style="text-align: center;"><strong><img alt="" src="https://simg.open-open.com/show/f86dcc72aafdca19d86829ce310708d8.jpg" /></strong></p>    <p> </p>    <p>Retrofit是Square公司开发的一个类型安全的Java和Android 的REST客户端库,这个库为网络认证、API请求以及用OkHttp发送网络请求提供了强大的框架 。Retrofit 库使得从web api下载JSON 或者xml数据变的非常简单直接,一旦数据下载完成即将其解析成普通java类(POJO)。</p>    <p>Retrofit特点 :</p>    <ul>     <li>底层使用OkHttp进行网络传输,性能好,速度快;</li>     <li>拥有出色的API文档和社区支持 ;</li>     <li>可以自动将REST API返回的数据转化为Java对象,且支持多种数据转换格式(如json、xml等) ;</li>     <li>使用Java注解声明HTTP请求 ;</li>     <li>支持 Multipart请求和文件上传;</li>    </ul>    <p style="text-align: center;"><a href="https://simg.open-open.com/show/c563deeeff9d95d1a5cac0aba0a85ecd.png"><img alt="" src="https://simg.open-open.com/show/c563deeeff9d95d1a5cac0aba0a85ecd.png" /></a></p>    <h2>更新日志</h2>    <ul>     <li>RxJava 2.x is now supported with a first-party 'adapter-rxjava2' artifact.</li>     <li>New: <code>@QueryName</code> annotation allows creating a query parameter with no '=' separator or value.</li>     <li>New: Support for messages generated by Protobuf 3.0 or newer when using the converter for Google's protobuf.</li>     <li>New: RxJava 1.x call adapter now correctly handles broken subscribers whose methods throw exceptions.</li>     <li>New: Add <code>toString()</code> implementations for <code>Response</code> and <code>Result</code>.</li>     <li>New: The Moshi converter factory now offers methods for enabling null serialization and lenient parsing.</li>     <li>New: Add <code>createAsync()</code> to RxJava 1.x call adapter factory which executes requests using <code>Call.enqueue()</code> using the underlying HTTP client's asynchronous support.</li>     <li>New: <code>NetworkBehavior</code> now allows setting an error percentage and returns HTTP errors when triggered.</li>     <li><code>HttpException</code> has been moved into the main artifact and should be used instead of the versions embedded in each adapter (which have been deprecated).</li>     <li>Promote the response body generic type on <code>CallAdapter</code> from the <code>adapt</code> method to the enclosing class. This is a source-incompatible but binary-compatible change which is only relevant if you are implementing your own <code>CallAdapter</code>s.</li>     <li>Remove explicit handling of the now-defunct RoboVM platform.</li>     <li>Fix: Close response on HTTP 204 and 205 to avoid resource leak.</li>     <li>Fix: Reflect the canceled state of the HTTP client's <code>Call</code> in Retrofit's <code>Call</code>.</li>     <li>Fix: Use supplied string converters for the <code>String</code> type on non-body parameters. This allows user converters to handle cases such as when annotating string parameters instead of them always using the raw string.</li>     <li>Fix: Skip a UTF-8 BOM (if present) when using the converter for Moshi.</li>    </ul>    <h2>下载</h2>    <ul>     <li><a href="/misc/goto?guid=4959000306905717396" rel="nofollow"><strong>Source code</strong> (zip)</a></li>     <li><a href="/misc/goto?guid=4959000307033766226" rel="nofollow"><strong>Source code</strong> (tar.gz)</a></li>    </ul>    <p>本站原创,转载时保留以下信息:<br /> 本文转自:深度开源(open-open.com)<br /> 原文地址:<a href="http://www.open-open.com/news/view/479d0bb6">http://www.open-open.com/news/view/479d0bb6</a></p>