public class HttpRequestDecoder extends Object
Modifier and Type | Class and Description |
---|---|
static class |
HttpRequestDecoder.Step |
Modifier and Type | Field and Description |
---|---|
static int |
MAX_LENGTH_OF_HEADER
头部,最多有多少字节
|
static int |
MAX_LENGTH_OF_HEADERLINE
头部,每行最大的字节数
|
static int |
MAX_LENGTH_OF_REQUESTLINE
请求行的最大长度
|
Constructor and Description |
---|
HttpRequestDecoder() |
Modifier and Type | Method and Description |
---|---|
static HttpRequest |
decode(ByteBuffer buffer,
int limit,
int position,
int readableLength,
ChannelContext channelContext,
HttpConfig httpConfig) |
static void |
decodeParams(Map<String,Object[]> params,
String queryString,
String charset,
ChannelContext channelContext) |
static void |
parseBodyFormat(HttpRequest httpRequest,
Map<String,String> headers)
Content-Type : application/x-www-form-urlencoded; charset=UTF-8
Content-Type : application/x-www-form-urlencoded; charset=UTF-8
|
static boolean |
parseHeaderLine(ByteBuffer buffer,
Map<String,String> headers,
int hasReceivedHeaderLength,
HttpConfig httpConfig)
解析请求头的每一行
|
static RequestLine |
parseRequestLine(ByteBuffer buffer,
ChannelContext channelContext)
parse request line(the first line)
|
public static final int MAX_LENGTH_OF_HEADER
public static final int MAX_LENGTH_OF_HEADERLINE
public static final int MAX_LENGTH_OF_REQUESTLINE
public static HttpRequest decode(ByteBuffer buffer, int limit, int position, int readableLength, ChannelContext channelContext, HttpConfig httpConfig) throws TioDecodeException
buffer
- limit
- position
- readableLength
- channelContext
- httpConfig
- TioDecodeException
public static void decodeParams(Map<String,Object[]> params, String queryString, String charset, ChannelContext channelContext) throws TioDecodeException
params
- queryString
- charset
- channelContext
- TioDecodeException
public static void parseBodyFormat(HttpRequest httpRequest, Map<String,String> headers)
httpRequest
- headers
- public static boolean parseHeaderLine(ByteBuffer buffer, Map<String,String> headers, int hasReceivedHeaderLength, HttpConfig httpConfig) throws TioDecodeException
buffer
- headers
- hasReceivedHeaderLength
- httpConfig
- TioDecodeException
public static RequestLine parseRequestLine(ByteBuffer buffer, ChannelContext channelContext) throws TioDecodeException
line
- GET /tio?value=tanyaowu HTTP/1.1channelContext
- TioDecodeException
Copyright © 2021. All rights reserved.