@UnstableApi public final class HttpConversionUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
HttpConversionUtil.ExtensionHeaderNames
Provides the HTTP header extensions used to carry HTTP/2 information in HTTP objects
|
Modifier and Type | Field and Description |
---|---|
static HttpMethod |
OUT_OF_MESSAGE_SEQUENCE_METHOD
This will be the method used for HttpRequest objects generated out of the HTTP message flow defined in
|
static String |
OUT_OF_MESSAGE_SEQUENCE_PATH
This will be the path used for HttpRequest objects generated out of the HTTP message flow defined in
|
static HttpResponseStatus |
OUT_OF_MESSAGE_SEQUENCE_RETURN_CODE
This will be the status code used for HttpResponse objects generated out of the HTTP message flow defined
in
|
Modifier and Type | Method and Description |
---|---|
static void |
addHttp2ToHttpHeaders(int streamId,
Http2Headers sourceHeaders,
FullHttpMessage destinationMessage,
boolean addToTrailer)
Translate and add HTTP/2 headers to HTTP/1.x headers.
|
static void |
addHttp2ToHttpHeaders(int streamId,
Http2Headers inputHeaders,
HttpHeaders outputHeaders,
HttpVersion httpVersion,
boolean isTrailer,
boolean isRequest)
Translate and add HTTP/2 headers to HTTP/1.x headers.
|
static HttpResponseStatus |
parseStatus(CharSequence status)
Apply HTTP/2 rules while translating status code to
HttpResponseStatus |
static FullHttpRequest |
toFullHttpRequest(int streamId,
Http2Headers http2Headers,
ByteBufAllocator alloc,
boolean validateHttpHeaders)
Create a new object to contain the request data
|
static Http2Headers |
toHttp2Headers(HttpHeaders inHeaders,
boolean validateHeaders) |
static void |
toHttp2Headers(HttpHeaders inHeaders,
Http2Headers out) |
static Http2Headers |
toHttp2Headers(HttpMessage in,
boolean validateHeaders)
Converts the given HTTP/1.x headers into HTTP/2 headers.
|
static HttpRequest |
toHttpRequest(int streamId,
Http2Headers http2Headers,
boolean validateHttpHeaders)
Create a new object to contain the request data.
|
static FullHttpResponse |
toHttpResponse(int streamId,
Http2Headers http2Headers,
ByteBufAllocator alloc,
boolean validateHttpHeaders)
Create a new object to contain the response data
|
public static final HttpMethod OUT_OF_MESSAGE_SEQUENCE_METHOD
HttpRequest
objects generated out of the HTTP message flow defined in HTTP/2 Spec Message Flowpublic static final String OUT_OF_MESSAGE_SEQUENCE_PATH
HttpRequest
objects generated out of the HTTP message flow defined in HTTP/2 Spec Message Flowpublic static final HttpResponseStatus OUT_OF_MESSAGE_SEQUENCE_RETURN_CODE
HttpResponse
objects generated out of the HTTP message flow defined
in HTTP/2 Spec Message Flowpublic static HttpResponseStatus parseStatus(CharSequence status) throws Http2Exception
HttpResponseStatus
status
- The status from an HTTP/2 frameHttp2Exception
- If there is a problem translating from HTTP/2 to HTTP/1.xpublic static FullHttpResponse toHttpResponse(int streamId, Http2Headers http2Headers, ByteBufAllocator alloc, boolean validateHttpHeaders) throws Http2Exception
streamId
- The stream associated with the responsehttp2Headers
- The initial set of HTTP/2 headers to create the response withalloc
- The ByteBufAllocator
to use to generate the content of the messagevalidateHttpHeaders
- true
to validate HTTP headers in the http-codecfalse
not to validate HTTP headers in the http-codecHttp2Exception
- see addHttp2ToHttpHeaders(int, Http2Headers, FullHttpMessage, boolean)
public static FullHttpRequest toFullHttpRequest(int streamId, Http2Headers http2Headers, ByteBufAllocator alloc, boolean validateHttpHeaders) throws Http2Exception
streamId
- The stream associated with the requesthttp2Headers
- The initial set of HTTP/2 headers to create the request withalloc
- The ByteBufAllocator
to use to generate the content of the messagevalidateHttpHeaders
- true
to validate HTTP headers in the http-codecfalse
not to validate HTTP headers in the http-codecHttp2Exception
- see addHttp2ToHttpHeaders(int, Http2Headers, FullHttpMessage, boolean)
public static HttpRequest toHttpRequest(int streamId, Http2Headers http2Headers, boolean validateHttpHeaders) throws Http2Exception
streamId
- The stream associated with the requesthttp2Headers
- The initial set of HTTP/2 headers to create the request withvalidateHttpHeaders
- true
to validate HTTP headers in the http-codecfalse
not to validate HTTP headers in the http-codecHttp2Exception
- see addHttp2ToHttpHeaders(int, Http2Headers, FullHttpMessage, boolean)
public static void addHttp2ToHttpHeaders(int streamId, Http2Headers sourceHeaders, FullHttpMessage destinationMessage, boolean addToTrailer) throws Http2Exception
streamId
- The stream associated with sourceHeaders
.sourceHeaders
- The HTTP/2 headers to convert.destinationMessage
- The object which will contain the resulting HTTP/1.x headers.addToTrailer
- true
to add to trailing headers. false
to add to initial headers.Http2Exception
- If not all HTTP/2 headers can be translated to HTTP/1.x.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
- The stream associated with sourceHeaders
.inputHeaders
- The HTTP/2 headers to convert.outputHeaders
- The object which will contain the resulting HTTP/1.x headers..httpVersion
- What HTTP/1.x version outputHeaders
should be treated as when doing the conversion.isTrailer
- true
if outputHeaders
should be treated as trailing headers.
false
otherwise.isRequest
- true
if the outputHeaders
will be used in a request message.
false
for response message.Http2Exception
- If not all HTTP/2 headers can be translated to HTTP/1.x.public static Http2Headers toHttp2Headers(HttpMessage in, boolean validateHeaders)
HOST
header or the
Request-Line
as defined by rfc7230
HttpConversionUtil.ExtensionHeaderNames.PATH
is ignored and instead extracted from the Request-Line
.public static Http2Headers toHttp2Headers(HttpHeaders inHeaders, boolean validateHeaders)
public static void toHttp2Headers(HttpHeaders inHeaders, Http2Headers out)
Copyright © 2008–2017 The Netty Project. All rights reserved.