users@grizzly.java.net

sending data back to client : OutputWriter.flushChannel or ctx.getAsyncQueueWritable()

From: Survivant 00 <survivant00_at_gmail.com>
Date: Thu, 10 Jul 2008 16:29:05 -0400

I been able to parse the data and get a valid message using XXX

not I want to send back data to the client.

I found differents ways to send to the client, but don't know which one I
should use.

ctx.getAsyncQueueWritable().writeToAsyncQueue(buffer, null, null, true);

or

SelectableChannel channel = context.getSelectionKey().channel();
        try {
            //DEBUG HERE.. just to see how that work.
            ByteBuffer writeBuffer =
ByteBuffer.allocateDirect(query.length());

            writeBuffer.put(query.getBytes());

            writeBuffer.flip();

            if (context.getProtocol() == Controller.Protocol.TCP) { // TCP
case
                OutputWriter.flushChannel(channel, writeBuffer);
            }
        } catch (IOException ex) {
            throw ex;
        }