public class HttpServerAioHandler extends Object implements ServerAioHandler
| Modifier and Type | Field and Description |
|---|---|
protected HttpConfig |
httpConfig |
static String |
REQUEST_KEY |
| Constructor and Description |
|---|
HttpServerAioHandler(HttpConfig httpConfig,
HttpRequestHandler requestHandler) |
| Modifier and Type | Method and Description |
|---|---|
HttpRequest |
decode(ByteBuffer buffer,
int limit,
int position,
int readableLength,
ChannelContext channelContext)
根据ByteBuffer解码成业务需要的Packet对象.
|
ByteBuffer |
encode(Packet packet,
TioConfig tioConfig,
ChannelContext channelContext)
编码
|
HttpConfig |
getHttpConfig() |
void |
handler(Packet packet,
ChannelContext channelContext)
处理消息包
|
void |
setHttpConfig(HttpConfig httpConfig) |
public static final String REQUEST_KEY
protected HttpConfig httpConfig
public HttpServerAioHandler(HttpConfig httpConfig, HttpRequestHandler requestHandler)
public HttpRequest decode(ByteBuffer buffer, int limit, int position, int readableLength, ChannelContext channelContext) throws TioDecodeException
AioHandlerdecode in interface AioHandlerbuffer - 参与本次希望解码的ByteBufferlimit - ByteBuffer的limitposition - ByteBuffer的position,不一定是0哦readableLength - ByteBuffer参与本次解码的有效数据(= limit - position)AioDecodeExceptionTioDecodeExceptionpublic ByteBuffer encode(Packet packet, TioConfig tioConfig, ChannelContext channelContext)
AioHandlerencode in interface AioHandlerpublic HttpConfig getHttpConfig()
public void handler(Packet packet, ChannelContext channelContext) throws Exception
AioHandlerhandler in interface AioHandlerExceptionpublic void setHttpConfig(HttpConfig httpConfig)
httpConfig - the httpConfig to setCopyright © 2021. All rights reserved.