Hi,
I am working on programming an ICAP-server (a HTTP-like protocol). So
far I just adapted the HTTP codec example. I created IcapRequestDecoder,
IcapResponseEncoder and ServerHandler (just like the HTTP example).
Now I have a question regarding errors:
Scenario:
The client sends me a message which violates the protocol. As far as I
understood, this problem should be detected in
IcapRequestDecoder.decode. Right?
Ok. Now I have three options to handle such an error (I have to inform
the client what the problem was - like HTTP '400 Bad Request'):
1. send a message immediately; return MessageDecoderResult.NOT_OK (not
so good idea i think)
2. let ServerHandler.exceptionCaught send the error message to the
client. In the second case I don't know how to find out what Exception
was thrown or what message to return to the client. cause.getMessage()
don't just returns the message of my Exception, but Exceptionname and
Hexdump information.
3. Just return MessageDecoderResult.NOT_OK, get to
ServerHandler.exceptionCaught and I have the same problem as before.
What is your recommended way, of informing the client of errors using
protocol codecs?
Sorry, if I overlooked something, which should be obvious - as the
subject says, I'm a MINA-newbie.
best regards
Stefan Bischof