Hi Randy,

On 8/31/06, Randy Watler <[EMAIL PROTECTED]> wrote:

I am attempting to use Mina to build a scalable Ajax web application
test harness, (a Mina client). So far, so good... :-).

One quick question: I have an operational HTTP message decoder in place,
but I am not sure how to support the parsing of a complete HTTP response
when the HTTP Content-length is not known. In particular, I need to know
when the underling session is closing, (IoSession.isClosing() == true),
while parsing the last packet from the server. It seems this is not now
the case. I will eventually get an IoHander.sessionClosing() callback,
but the undecoded message is left hanging out there with decodable()
returning false.

To hack this, I figure I could add a last "unknown content length"
ByteBuffer as a session attribute from MessageDecoder.decodable(),
(carefully acquire() and release() managed), and process it on
IoHandler.sessionClosing() manually. This seems kind of ugly and not
within the spirit of the Mina API. Any suggestions how to better handle
this?


Ah, so.. in HTTP/1.0, 'EOC (end of connection)' can be a useful information
for decoding, but it is not informed to ProtocolDecoder, right?  This is
certainly a problem.

For now, ProtocolDecoder.dispose() is invoked just before sessionClosed() is
invoked.  So we could add a ProtocolDecoderOutput parameter to dispose()
method, but I think is not a good idea.  Providing another method like
'finishDecode()' would be better to separate the decoding code and the
resource management code.

What do you think?

Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6

Reply via email to