HTTP Client Connection: Choosing Between HttpClient and OkHttp

HTTP Client Connection: Choosing Between HttpClient and OkHttp

Click on the blue text above“ Reply with “666” to receive the most popular Java core knowledge summary on the internet Is He Tiantian here? https://www.jianshu.com/p/68c30beca612 Code example: https://github.com/TiantianUpup/http-call Introduction The reason for writing this article stems from a conversation with a friend. This touches on my knowledge blind spot, so I started by searching … Read more

HttpClient is Outdated, OkHttp is Losing Ground! This Tool is the New King!

HttpClient is Outdated, OkHttp is Losing Ground! This Tool is the New King!

We are dedicated to exploring, sharing, and recommending the latest practical technology stacks, open-source projects, frameworks, and useful tools. Fresh open-source information awaits your discovery every day! Using <span>SpringBoot</span> directly with <span>OkHttp</span>, <span>HttpClient</span>, or <span>RestTemplate</span> to initiate <span>HTTP</span> requests is cumbersome and inconvenient for unified management. Therefore, we recommend a lightweight HTTP client framework suitable … Read more

Advanced Customization of OkHttp: Request Retries, Caching Strategies, and DNS Optimization for Mastering Network Requests!

Advanced Customization of OkHttp: Request Retries, Caching Strategies, and DNS Optimization for Mastering Network Requests!

Advanced Customization of OkHttp: Request Retries, Caching Strategies, and DNS Optimization for Mastering Network Requests! Last year during the Double Eleven shopping festival, our e-commerce app suddenly experienced a large number of network request timeouts during peak hours, leading to a flood of user complaints about product pages not loading. After urgent investigation, we found … Read more

Bypassing OkHttp3 Certificate Validation [Demo Included]

Bypassing OkHttp3 Certificate Validation [Demo Included]

Disclaimer:The technologies, ideas, and tools mentioned in this article are for educational purposes only and should be used for security-related learning and communication. No one is allowed to use them for illegal purposes or for profit; otherwise, the consequences will be borne by the user!If there are any infringements, please let me know, and I … Read more

Advantages of OkHttp and Best Practice Examples

Advantages of OkHttp and Best Practice Examples

Advantages of OkHttp and Best Practice Examples // Add dependencies implementation("com.squareup.okhttp3:okhttp:4.12.0") implementation("com.squareup.okhttp3:logging-interceptor:4.12.0") — Efficient Performance with HTTP/2 Connection Reuse // In e-commerce applications, batch load product images and details fun loadProductData() { val client = OkHttpClient.Builder() .build() // Batch request product data val requests = listOf( Request.Builder().url("https://api.example.com/products/1").build(), Request.Builder().url("https://api.example.com/products/1/images").build(), Request.Builder().url("https://api.example.com/products/1/reviews").build() ) // Execute requests concurrently (utilizing … Read more

The Useful HTTP Client Library OkHttp

The Useful HTTP Client Library OkHttp

OkHttp In Spring Boot development, calling third-party HTTP interfaces is a very common requirement, such as calling microservices or accessing external APIs. Although Spring Boot provides HTTP calling tools like RestTemplate and WebClient, sometimes we may need a lower-level, more flexible, and higher-performance HTTP client library, and OkHttp is a relatively mature solution. Why Choose … Read more

Building an Enterprise-Level OkHttp Interceptor System from Scratch: Dynamic Token, Retry Strategy, and In-Depth Source Code Analysis

Building an Enterprise-Level OkHttp Interceptor System from Scratch: Dynamic Token, Retry Strategy, and In-Depth Source Code Analysis

Introduction This article focuses on the OkHttp interceptor, building an enterprise-level network request framework from scratch. Through practical cases such as dynamic token management, intelligent retry strategies, and enhanced logging, combined with in-depth source code analysis, we will thoroughly explain the underlying logic and engineering applications of interceptors. The code examples cover the latest features … Read more

Seven Methods for Implementing HTTP Calls in Spring Boot

Seven Methods for Implementing HTTP Calls in Spring Boot

Hello everyone, I am Xia Yi. Today I will share about HTTP calling methods. Most projects are currently using the Spring Boot framework, and HTTP calls are an inevitable part of daily development. Whether calling third-party APIs or implementing communication between microservices, HTTP requests play a crucial role. This article will introduce seven efficient and … Read more

Essential Knowledge of HTTP

Essential Knowledge of HTTP

This article is sponsored by Yugang Writing Platform with a sponsorship amount of 200 yuan. Original author: Zhu Qiandai. Copyright statement: This article is copyrighted by the WeChat public account Yugang Says. Unauthorized reproduction in any form is prohibited. HTTP is a network application layer protocol that we frequently interact with, and its importance cannot … Read more

Understanding HTTP 2.0 and OkHttp

Understanding HTTP 2.0 and OkHttp

HTTP 2.0 is an extension of 1.x rather than a replacement. It is called “2.0” because it changes the way data is exchanged between clients and servers. HTTP 2.0 introduces a new binary framing layer that is not compatible with previous HTTP 1.x servers and clients — hence the name 2.0. Before formally introducing HTTP … Read more