开发者

MINA: Is finishDecode where I send a response message?

开发者 https://www.devze.com 2022-12-16 15:41 出处:网络
In using Apache MINA, I\'m sending a login request from the client, which is interpreted on the server via LoginRequestDecoder (implements org.apache.mina.filter.codec.demux.MessageDecoder).

In using Apache MINA, I'm sending a login request from the client, which is interpreted on the server via LoginRequestDecoder (implements org.apache.mina.filter.codec.demux.MessageDecoder).

开发者_如何学JAVAI now want to send a response (LoginResponse) that includes a success/failure code. Should I be sending the response from the LoginRequestDecoder's finishDecode() method, or is there a better place for it that I'm overlooking?


What I needed to do was make my IoHandler of type DemuxingIoHandler. Within its constructuor, I had to make multiple calls to addReceivedMessageHandler and addSentMessageHandler. This allows the code behind DemuxingIoHandler to automatically respond based upon the type of message received.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号