@UnstableApi
public final class HttpConversionUtil
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
HttpConversionUtil.ExtensionHeaderNames
提供用于在HTTP对象中携带HTTP / 2信息的HTTP标头扩展
|
| Modifier and Type | Field and Description |
|---|---|
static HttpMethod |
OUT_OF_MESSAGE_SEQUENCE_METHOD
这将是用于 HttpRequest对象的方法, 这些对象由中定义的HTTP消息流生成
|
static java.lang.String |
OUT_OF_MESSAGE_SEQUENCE_PATH
这将是用于 HttpRequest对象的路径, 该对象由中定义的HTTP消息流生成
|
static HttpResponseStatus |
OUT_OF_MESSAGE_SEQUENCE_RETURN_CODE
这将是用于 HttpResponse对象的状态代码, 该对象由中定义的HTTP消息流生成
|
| Modifier and Type | Method and Description |
|---|---|
static void |
addHttp2ToHttpHeaders(int streamId, Http2Headers sourceHeaders, FullHttpMessage destinationMessage, boolean addToTrailer)
将HTTP / 2标头翻译并添加到HTTP / 1.x标头。
|
static void |
addHttp2ToHttpHeaders(int streamId, Http2Headers inputHeaders, HttpHeaders outputHeaders, HttpVersion httpVersion, boolean isTrailer, boolean isRequest)
将HTTP / 2标头翻译并添加到HTTP / 1.x标头。
|
static HttpResponseStatus |
parseStatus(java.lang.CharSequence status)
在将状态代码翻译为 HttpResponseStatus的同时应用HTTP / 2规则
|
static FullHttpRequest |
toFullHttpRequest(int streamId, Http2Headers http2Headers, ByteBufAllocator alloc, boolean validateHttpHeaders)
创建一个新的对象来包含请求数据
|
static FullHttpResponse |
toFullHttpResponse(int streamId, Http2Headers http2Headers, ByteBufAllocator alloc, boolean validateHttpHeaders)
创建一个新的对象来包含响应数据
|
static Http2Headers |
toHttp2Headers(HttpHeaders inHeaders, boolean validateHeaders) |
static void |
toHttp2Headers(HttpHeaders inHeaders, Http2Headers out) |
static Http2Headers |
toHttp2Headers(HttpMessage in, boolean validateHeaders)
将给定的HTTP / 1.x标头转换为HTTP / 2标头。
|
static HttpRequest |
toHttpRequest(int streamId, Http2Headers http2Headers, boolean validateHttpHeaders)
创建一个新的对象来包含请求数据。
|
static HttpResponse |
toHttpResponse(int streamId, Http2Headers http2Headers, boolean validateHttpHeaders)
创建一个新的对象来包含响应数据。
|
public static final HttpMethod OUT_OF_MESSAGE_SEQUENCE_METHOD
HttpRequest对象的方法, 该对象由HTTP/2 Spec Message Flow中定义的HTTP消息流生成
public static final java.lang.String OUT_OF_MESSAGE_SEQUENCE_PATH
HttpRequest对象的路径, 该对象由HTTP/2 Spec Message Flow中定义的HTTP消息流生成
public static final HttpResponseStatus OUT_OF_MESSAGE_SEQUENCE_RETURN_CODE
HttpResponse名HTTP消息流的生成的对象中所定义HTTP/2 Spec Message Flow
public static HttpResponseStatus parseStatus(java.lang.CharSequence status) throws Http2Exception
HttpResponseStatus时应用HTTP / 2规则
status - 来自HTTP / 2帧的状态
Http2Exception - 如果从HTTP / 2转换为HTTP / 1.x时出现问题
public static FullHttpResponse toFullHttpResponse(int streamId, Http2Headers http2Headers, ByteBufAllocator alloc, boolean validateHttpHeaders) throws Http2Exception
streamId - 与响应关联的流
http2Headers - 用来创建响应的最初一组HTTP / 2头
alloc - ByteBufAllocator用于生成消息的内容
validateHttpHeaders -
true验证http-codec中的HTTP标头 false不要验证http-codec中的HTTP标头 Http2Exception - 见
addHttp2ToHttpHeaders(int, Http2Headers, FullHttpMessage, boolean)
public static FullHttpRequest toFullHttpRequest(int streamId, Http2Headers http2Headers, ByteBufAllocator alloc, boolean validateHttpHeaders) throws Http2Exception
streamId - 与请求关联的流
http2Headers - 用来创建请求的最初一组HTTP / 2头
alloc - 用于生成消息内容的ByteBufAllocator
validateHttpHeaders -
true来验证http-codec中的HTTP标头 false不要验证http-codec中的HTTP标头 Http2Exception - 见
addHttp2ToHttpHeaders(int, Http2Headers, FullHttpMessage, boolean)
public static HttpRequest toHttpRequest(int streamId, Http2Headers http2Headers, boolean validateHttpHeaders) throws Http2Exception
streamId - 与请求关联的流
http2Headers - 用来创建请求的最初一组HTTP / 2头
validateHttpHeaders -
true验证http-codec中的HTTP标头 false不要验证http-codec中的HTTP标头 Http2Exception - 见
addHttp2ToHttpHeaders(int, Http2Headers, FullHttpMessage, boolean)
public static HttpResponse toHttpResponse(int streamId, Http2Headers http2Headers, boolean validateHttpHeaders) throws Http2Exception
streamId - 与响应关联的流
http2Headers - 用于创建响应的最初一组HTTP / 2头
validateHttpHeaders -
true验证http-codec中的HTTP标头 false不要验证http-codec中的HTTP标头 Http2Exception - 见
addHttp2ToHttpHeaders(int, Http2Headers, HttpHeaders, HttpVersion, boolean, boolean)
public static void addHttp2ToHttpHeaders(int streamId,
Http2Headers sourceHeaders,
FullHttpMessage destinationMessage,
boolean addToTrailer)
throws Http2Exception
streamId - 与
sourceHeaders相关的流。
sourceHeaders - 要转换的HTTP / 2头。
destinationMessage - 将包含生成的HTTP / 1.x标头的对象。
addToTrailer - true添加到尾部标题。
false添加到初始标题。
Http2Exception - 如果不是所有HTTP / 2标头都可以转换为HTTP /
Http2Exception
addHttp2ToHttpHeaders(int, Http2Headers, HttpHeaders, HttpVersion, boolean, boolean)
public static void addHttp2ToHttpHeaders(int streamId,
Http2Headers inputHeaders,
HttpHeaders outputHeaders,
HttpVersion httpVersion,
boolean isTrailer,
boolean isRequest)
throws Http2Exception
streamId - 与
sourceHeaders关联的流。
inputHeaders - 要转换的HTTP / 2头。
outputHeaders - 将包含生成的HTTP / 1.x标头的对象。
httpVersion - 在执行转换时应将HTTP / 1.x版本
outputHeaders视为什么。
isTrailer - true如果outputHeaders应视为尾部标题。
否则为false 。
isRequest - true如果outputHeaders将用于请求消息。
false用于回复消息。
Http2Exception - 如果不是所有HTTP / 2标头都可以转换为HTTP /
Http2Exception
public static Http2Headers toHttp2Headers(HttpMessage in, boolean validateHeaders)
HOST标题或HOST标题中的Request-Line定义的标题中找不到
HttpConversionUtil.ExtensionHeaderNames.PATH被忽略,而是从Request-Line提取。
public static Http2Headers toHttp2Headers(HttpHeaders inHeaders, boolean validateHeaders)
public static void toHttp2Headers(HttpHeaders inHeaders, Http2Headers out)
Copyright © 2008–2018 The Netty Project. All rights reserved.