On Tue, Oct 21, 2008 at 4:21 PM, newToMina <[EMAIL PROTECTED]> wrote:

>
> What if the client writes multiple requests at once as follows.
> <root><msg>this is message 1</msg></root><root><msg>this is message
> 2</msg></root>
>
> How does the messageReceived() see it? How do I seperate and process these
> 2
> xml messages (remember there are no controll characters seperating the xml
> documents) and send the corresponding 2 response messages back? Will it be
> through the same IOSession? Please bear with me if these questions sound
> silly, as I am trying to better understand how MINA works.


It certainly is not a silly question.
If there REALLY is no guarantee about a newline (or other character) between
two xml messages written on the same socket
than you have to take that into account when implementing your decoder.

It's certainly no rocket science. One approach would be to read one byte at
a time from the IoBuffer and add it to some temporary structure. After each
byte, check if the temp structure contains a complete xml message.

This is similar to what TextLineDecoder does, that's why I mentioned it.

Maarten


>
>
>
>
> Andres Martinez Quijano wrote:
> >
> > On Tue, Oct 21, 2008 at 5:44 AM, Maarten Bosteels
> > <[EMAIL PROTECTED]> wrote:
> >> Emmanual, I am afraid this only holds when there is at least one newline
> >> between two xml messages.
> >> Suppose the incoming xml looks like this:
> >>
> >> <root><msg>this is message 1</msg></root><root>CRLF
> >> <msg>this is message 2</msg></root>
> >>
> >> I agree that it's unlikely but who knows ...
> >>
> >> Maarten
> >
> > That's not well-formed XML, it should have only one root node, so you
> > can search for it and it's closing, whichever line is it into
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/MINA---design-guidelines-tp20077627p20091310.html
> Sent from the Apache MINA User Forum mailing list archive at Nabble.com.
>
>

Reply via email to