MINA: Is finishDecode where I send a response message?
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.
精彩评论