Package org.miaixz.bus.http.metric.http
Class Http2Codec
java.lang.Object
org.miaixz.bus.http.metric.http.Http2Codec
- All Implemented Interfaces:
HttpCodec
使用HTTP/2帧对请求和响应进行编码.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
Fields inherited from interface org.miaixz.bus.http.metric.http.HttpCodec
DISCARD_STREAM_TIMEOUT_MILLIS -
Constructor Summary
ConstructorsConstructorDescriptionHttp2Codec(Httpd client, RealConnection realConnection, NewChain chain, Http2Connection connection) -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()取消这个流。返回携带此编解码器的连接org.miaixz.bus.core.io.sink.SinkcreateRequestBody(Request request, long contentLength) 返回一个可以对请求体进行流处理的输出流.void将请求刷新到基础套接字,就不会传输更多的字节.void将请求刷新到基础套接字static List<Http2Header> http2HeadersList(Request request) org.miaixz.bus.core.io.source.SourceopenResponseBodySource(Response response) static Response.BuilderreadHttp2HeadersList(Headers headerBlock, org.miaixz.bus.core.net.Protocol protocol) Returns headers for a name value block containing an HTTP/2 response.readResponseHeaders(boolean expectContinue) 从HTTP传输解析响应头的字节longreportedContentLength(Response response) trailers()在HTTP响应之后返回voidwriteRequestHeaders(Request request) 这应该更新HTTP引擎的sentRequestMillis字段.
-
Constructor Details
-
Http2Codec
public Http2Codec(Httpd client, RealConnection realConnection, NewChain chain, Http2Connection connection)
-
-
Method Details
-
http2HeadersList
-
readHttp2HeadersList
public static Response.Builder readHttp2HeadersList(Headers headerBlock, org.miaixz.bus.core.net.Protocol protocol) throws IOException Returns headers for a name value block containing an HTTP/2 response.- Throws:
IOException
-
connection
Description copied from interface:HttpCodec返回携带此编解码器的连接- Specified by:
connectionin interfaceHttpCodec
-
createRequestBody
Description copied from interface:HttpCodec返回一个可以对请求体进行流处理的输出流.- Specified by:
createRequestBodyin interfaceHttpCodec- Parameters:
request- 网络请求contentLength- 内容长度- Returns:
- 缓冲信息
-
writeRequestHeaders
Description copied from interface:HttpCodec这应该更新HTTP引擎的sentRequestMillis字段.- Specified by:
writeRequestHeadersin interfaceHttpCodec- Parameters:
request- 网络请求- Throws:
IOException- 异常
-
flushRequest
Description copied from interface:HttpCodec将请求刷新到基础套接字- Specified by:
flushRequestin interfaceHttpCodec- Throws:
IOException- 异常
-
finishRequest
Description copied from interface:HttpCodec将请求刷新到基础套接字,就不会传输更多的字节.- Specified by:
finishRequestin interfaceHttpCodec- Throws:
IOException- 异常
-
readResponseHeaders
Description copied from interface:HttpCodec从HTTP传输解析响应头的字节- Specified by:
readResponseHeadersin interfaceHttpCodec- Parameters:
expectContinue- 如果这是一个带有“100”响应代码的中间响应, 则返回null。否则,此方法永远不会返回null.- Returns:
- 响应构建器
- Throws:
IOException- 异常
-
reportedContentLength
- Specified by:
reportedContentLengthin interfaceHttpCodec
-
openResponseBodySource
- Specified by:
openResponseBodySourcein interfaceHttpCodec
-
trailers
Description copied from interface:HttpCodec在HTTP响应之后返回- Specified by:
trailersin interfaceHttpCodec- Returns:
- the object
- Throws:
IOException- 异常
-
cancel
public void cancel()Description copied from interface:HttpCodec取消这个流。这个流所持有的资源将被清理,尽管不是同步的。这可能会在连接池线程之后发生
-