Hello everyone, I am Bucai Chen~ We have a business that calls an http-based service provided by other departments, with daily calls in the tens of millions. Use httpclient to complete the business. Because qps could not be uploaded before, I took a look at the business code and made some optimizations, which are recorded […]
Tag: http
HTTP status code, response header, request header
1. Status code in Chinese 100: “Continue”, 101: “Exchange Agreement”, 200: “OK”, 201: “Created”, 202: “Accept”, 203: “Non-authoritative information”, 204: “No content”, 205: “Reset content”, 206: “Part of the content”, 300: “Multiple selection”, 301: “Moved permanently”, 302: “Found”, 303: “See others”, 304: “Not modified”, 305: “Use proxy”, 307: “Temporary Redirect”, 400: “Bad Request”, 401: “Unauthorized”, […]
HttpClient optimization solution in high concurrency scenarios, QPS is greatly improved!
Hello everyone, I am Bucai Chen~ We have a business that calls an http-based service provided by other departments, with daily calls in the tens of millions. Use httpclient to complete the business. Because qps could not be uploaded before, I took a look at the business code and made some optimizations, which are recorded […]
Apache-Httpclient retry tool class encapsulation
pom dependency <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.5</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpcore</artifactId> <version>4.4.4</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.7</version> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.76</version> </dependency> Http attribute constants package com.coolw.codedemo.http; /** * @Description Http attribute request constant * @Date 2021/5/11 11:46 * @Author coolw */ public interface HttpConstants { /** * Maximum number of connections in the connection […]
GET, POST request third-party interface HttpClient calls tool class
GET request example: Map<String, String> params = new HashMap<>(); params.put(“grant_type”, “client_credential”); params.put(“appid”,”your own appid”); params.put(“secret”, “your own secret key”); String resultStr = HttpClientUtil.sendGet(url, params); POST JOSN request example: JSONObject params = new JSONObject(); params.put(“Third-party request parameters”, “Own input parameters”); params.put(“Third-party request parameters”, “Own input parameters”); params.put(“Third-party request parameters”, “Own input parameters”); params.put(“Third-party request parameters”, “Own […]
JavaEE_Constructing HTTP requests and HTTPS
Table of Contents 1. Construct HTTP request 1.1 form tag constructs HTTP request 1.1.1 form tag constructs GET request 1.1.2 Form tag constructs POST request 1.2 Construct HTTP request through ajax 1.3 form and ajax 1.4 Use ajax to construct HTTP requests 2.HTTPS 2.1 Symmetric encryption 2.2 Asymmetric encryption 2.3 Certificate 1. Construct HTTP request […]
go http programming learn from it dark horse
web workflow http protocol Hypertext Transfer Protocol is the most widespread network protocol on the Internet. Specifies the rules for communication between browsers and servers http request message Test through GO network programming TCP, UDP from Li Wenzhou-CSDN blog client, enter the listening IP and port in the edge browser, and get the following information: […]
Java http request tool class calls third-party interface
Directory Target 1. httpClient tool class 2. Example of sending a post request Goals Use http request tool class to call third-party interface 1. httpClient tool class import cn.hutool.core.collection.CollUtil; import com.alibaba.fastjson.JSONObject; import org.apache.http.client.methods.CloseableHttpResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.*; import org.springframework.stereotype.Component; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestTemplate; import java.nio.charset.StandardCharsets; import java.util.Base64; import java.util.HashMap; import java.util.Map; import java.util.Objects; […]
04_01_Ajax+HTTP04_Cross-domain and JSONP
Original policy and cross-domain Same origin: If the protocol, domain name and port of two pages are the same, then the two pages have the same origin. Same origin policy Same origin policy (English full name Same origin policy) is a security feature provided by browsers. The concept given by MDN official: The same-origin policy […]
Handwritten http server–1. Analysis of http protocol
1. Foreword Hello everyone! I had nothing to do during the National Day holiday recently, and then I was thinking about the web server I was thinking about. I was learning javaweb when I was a freshman, and I felt amazing about Tomcat. The subsequent springboot and so on actually also have Tomcat embedded. We […]