Package org.miaixz.bus.http
Class Httpd
java.lang.Object
org.miaixz.bus.http.Httpd
- All Implemented Interfaces:
Cloneable,NewCall.Factory,WebSocket.Factory
发送HTTP请求辅助类
工厂的call,可以用来发送HTTP请求并读取它们的响应
当您创建一个
Httpd实例并将其用于所有HTTP调用时,体现Httpd的性能最佳
这是因为每个客户机都拥有自己的连接池和线程池。重用连接和线程可以减少延迟并节省内存
相反,为每个请求创建一个客户机会浪费空闲池上的资源
Httpd还为HTTP/2连接使用守护进程线程。如果它们保持空闲,就会自动退出- Since:
- Java 17+
- Author:
- Kimi Liu
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncache()intintdns()booleanboolean准备request在将来的某个时间点执行newWebSocket(Request request, WebSocketListener listener) 使用request连接一个新的web套接字intproxy()intbooleanint
-
Constructor Details
-
Httpd
public Httpd() -
Httpd
-
-
Method Details
-
newCall
准备request在将来的某个时间点执行- Specified by:
newCallin interfaceNewCall.Factory- Parameters:
request- 请求信息- Returns:
- the object
-
newWebSocket
使用request连接一个新的web套接字- Specified by:
newWebSocketin interfaceWebSocket.Factory- Parameters:
request- 请求信息listener- 监听器- Returns:
- the object
-
callTimeoutMillis
public int callTimeoutMillis() -
connectTimeoutMillis
public int connectTimeoutMillis() -
readTimeoutMillis
public int readTimeoutMillis() -
writeTimeoutMillis
public int writeTimeoutMillis() -
pingIntervalMillis
public int pingIntervalMillis() -
proxy
-
proxySelector
-
cookieJar
-
cache
-
dns
-
socketFactory
-
sslSocketFactory
-
hostnameVerifier
-
certificatePinner
-
authenticator
-
proxyAuthenticator
-
connectionPool
-
followSslRedirects
public boolean followSslRedirects() -
followRedirects
public boolean followRedirects() -
retryOnConnectionFailure
public boolean retryOnConnectionFailure() -
dispatcher
-
protocols
-
connectionSpecs
-
interceptors
-
networkInterceptors
-
eventListenerFactory
-
newBuilder
-