public class HttpHeaderUtil extends Object
| 构造器和说明 |
|---|
HttpHeaderUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static long |
getContentLength(io.netty.handler.codec.http.HttpMessage message,
long defaultValue)
Returns the length of the content.
|
static boolean |
is100ContinueExpected(io.netty.handler.codec.http.HttpRequest message)
Returns
true if and only if the specified message contains the
"Expect: 100-continue" header. |
static boolean |
isAcceptTransferChunked(io.netty.handler.codec.http.HttpHeaders headers)
是否接受分段传输
|
static boolean |
isFormUrlEncoder(String contentType) |
static boolean |
isKeepAlive(io.netty.handler.codec.http.HttpRequest message)
Returns
true if and only if the connection can remain open and
thus 'kept alive'. |
static boolean |
isTransferEncodingChunked(io.netty.handler.codec.http.HttpHeaders headers)
Checks to see if the transfer encoding in a specified
HttpMessage is chunked |
static boolean |
isUnsupportedExpectation(io.netty.handler.codec.http.HttpMessage message) |
static void |
removeHeaderUnSupportTrailer(io.netty.handler.codec.http.LastHttpContent lastHttpContent)
移除头部不支持拖挂的字段
|
static void |
set100ContinueExpected(io.netty.handler.codec.http.HttpMessage message,
boolean expected)
Sets or removes the
"Expect: 100-continue" header to / from the
specified message. |
static void |
setContentLength(io.netty.handler.codec.http.HttpHeaders headers,
long length)
Sets the
"Content-Length" header. |
static void |
setKeepAlive(io.netty.handler.codec.http.HttpResponse message,
boolean keepAlive)
Sets the value of the
"Connection" header depending on the
protocol version of the specified message. |
static void |
setTransferEncodingChunked(io.netty.handler.codec.http.HttpHeaders headers,
boolean chunked)
Sets the block transport header
|
public static boolean isFormUrlEncoder(String contentType)
public static void removeHeaderUnSupportTrailer(io.netty.handler.codec.http.LastHttpContent lastHttpContent)
lastHttpContent - 最后一次内容public static boolean isAcceptTransferChunked(io.netty.handler.codec.http.HttpHeaders headers)
headers - headerspublic static boolean isKeepAlive(io.netty.handler.codec.http.HttpRequest message)
true if and only if the connection can remain open and
thus 'kept alive'. This methods respects the value of the
"Connection" header first and then the return value of
HttpVersion.isKeepAliveDefault().message - messagepublic static void setKeepAlive(io.netty.handler.codec.http.HttpResponse message,
boolean keepAlive)
"Connection" header depending on the
protocol version of the specified message. This getMethod sets or removes
the "Connection" header depending on what the default keep alive
mode of the message's protocol version is, as specified by
HttpVersion.isKeepAliveDefault().
"close" if keepAlive is false."keep-alive" if keepAlive is true.message - messagekeepAlive - keepAlivepublic static boolean isUnsupportedExpectation(io.netty.handler.codec.http.HttpMessage message)
public static long getContentLength(io.netty.handler.codec.http.HttpMessage message,
long defaultValue)
ByteBufHolder.content() but from the
"Content-Length" header, and thus they are independent from each
other.message - messagedefaultValue - defaultValuedefaultValue if this message does
not have the "Content-Length" header or its value is not
a numberpublic static void setContentLength(io.netty.handler.codec.http.HttpHeaders headers,
long length)
"Content-Length" header.headers - headerslength - lengthpublic static boolean is100ContinueExpected(io.netty.handler.codec.http.HttpRequest message)
true if and only if the specified message contains the
"Expect: 100-continue" header.message - messagepublic static void set100ContinueExpected(io.netty.handler.codec.http.HttpMessage message,
boolean expected)
"Expect: 100-continue" header to / from the
specified message. If the specified value is true,
the "Expect: 100-continue" header is set and all other previous
"Expect" headers are removed. Otherwise, all "Expect"
headers are removed completely.message - messageexpected - expectedpublic static boolean isTransferEncodingChunked(io.netty.handler.codec.http.HttpHeaders headers)
HttpMessage is chunkedheaders - The message to checkpublic static void setTransferEncodingChunked(io.netty.handler.codec.http.HttpHeaders headers,
boolean chunked)
headers - The header of the setchunked - Whether to block transmission, is to add header information, otherwise remove header informationCopyright © 2021. All rights reserved.