Retrofit quick learning

Content mapping 1. Dependency library import implementation 'com.squareup.retrofit2:retrofit:2.4.0' implementation 'com.squareup.retrofit2:converter-gson:2.3.0' 2. Basic use 2.1 define request interface import hq.demo.net.model.WeatherBeans; import retrofit2.Call; import retrofit2.http.Field; import retrofit2.http.FormUrlEncoded; ...

Posted on Thu, 02 Jan 2020 07:29:30 -0500 by sonofsam

Android uses OkHttp3 to download multiple files and resume breakpoints

Recently, I encountered the problem of downloading online songs in the music app, so I have this article. This article draws on https://blog.csdn.net/cfy137000/article/details/54838608 , thank you for making some changes on this basis. The code is written by Kotlin, only the core code is shown here. class DownloadManager { ...

Posted on Mon, 30 Dec 2019 14:39:01 -0500 by dgny06

Interpretation of OKHttp Source Code

Interpretation of OKHttp Source Code Key objectives of this sharing 1. Approximate process interpretation, synchronous process, asynchronous process 2.Interceptor Brief Reading 1. Simple use of OKHttp private String get(String url) throws IOException { Request request = new Request.Builder() .url(url) ...

Posted on Sat, 28 Dec 2019 23:50:20 -0500 by mrmom

Retrofit docking with RxJava and OKhttp

Retrofit is an intermediate link in the whole network request architecture (Rxjava+Retrofit+OKhttp). The asynchronous decoupling layer is Rxjava, and the network request layer is OKhttp. How does Retrofit connect with the two? I'm a rookie. I'd like to write down my understanding here. If there is anything unreasonable, please ...

Posted on Sun, 22 Dec 2019 11:03:33 -0500 by Petrushka

Retrofit source code analysis

## Retrofit source code analysis ###Retrofit is the wrapper class of okhttp. All network requests are processed by okhttp. ####1. Initialize Retrofit #Retrofit public Retrofit build() { if (baseUrl == null) { throw new IllegalStateException("Base URL required."); } //If OkHttpClient is not set, a okhttp3.Ca ...

Posted on Mon, 16 Dec 2019 13:15:56 -0500 by yelvington

React Native custom NetworkingModule

1). Train of thought I. in the getPackages method of MainApplication, add the NetworkingModule module repeatedly, and the latter will overwrite the former. However, the canOverrideExistingModule method in the official NetworkingModule always returns false, so it cannot be replaced. @Override public boolean canOverrideExistingModu ...

Posted on Wed, 11 Dec 2019 13:12:27 -0500 by Eric T

Connection pool of Okhttp ConnectionPool

Catalog 1.get() method 2.put() Use and analysis of Okhttp3: https://mp.csdn.net/postedit/83339916 okhttp system Interceptor: https://mp.csdn.net/postedit/83536609 Connection pool of Okhttp: ConnectionPool: https://mp.csdn.net/postedit/83650740   Okhttp abstracts the communication links between the client and the server ...

Posted on Wed, 11 Dec 2019 10:48:04 -0500 by php_2004

Java's new project learning online notes - day4(2)

3.2.1.3 Dao Define the dao interface of CmsCon? g: public interface CmsConfigRepository extends MongoRepository<CmsConfig,String> { } 3.2.1.4 Service Define the CmsCon? gService implementation to query the CmsCon? g information according to the id. @Service public class CmsConfigService { @Autowired CmsConfigRepository cmsConfi ...

Posted on Fri, 06 Dec 2019 09:37:15 -0500 by bobocheez

springboot uses RestTemplate+okhttp connection pool to send http messages

1, introduction OkHttp is an efficient HTTP client, which allows all requests with the same host address to share the same socket connection; connection pool reduces request delay; transparent GZIP compression reduces the size of response data; caches response content to avoid some completely repeated requests When there is a problem in the n ...

Posted on Mon, 25 Nov 2019 10:22:37 -0500 by adelinewss

Spring framework learning notes: Spring Boot implementation upload and download

Recently, I'm too busy to write a blog. I've done a project, realized the download function, and didn't use upload. By the way, I've also learned how to upload, upload and download, and made a note download There are mainly two ways: Implemented through ResponseEntity By writing the OutputStream of HttpServletResponse I only tested that the ...

Posted on Wed, 20 Nov 2019 04:45:14 -0500 by kiosklim