[undertow-dev] Async sending of NIO objects thru a ServletOutputStream?

Jim Crossley jim at crossleys.org
Tue Sep 16 20:18:13 EDT 2014


I actually figured that out, Stuart, thanks. So I have writing a ByteBuffer
covered. Any thoughts on handling the ReadableByteChannel?  Looking at the
Jetty impl, it appears I need to read it into one or more ByteBuffers and
then write them out. Should I use the Pooled<ByteBuffer> from the exhange's
connection?

Jim

On Tue, Sep 16, 2014 at 6:00 PM, Stuart Douglas <sdouglas at redhat.com> wrote:

>
>
> Jim Crossley wrote:
>
>> Hi guys,
>>
>> I'm looking to promote Undertow as a preferred alternative to Jetty for
>> the Pedestal [1] framework.
>>
>> One Jetty feature it relies on is the async sending of ByteBuffers and
>> ReadableByteChannels in Jetty's impl of ServletOutputStream [2]. Two
>> methods, in particular: sendContent(ByteBuffer, Callback) and
>> sendContent(ReadableByteChannel, Callback).
>>
>
> If you have enabled async mode on the ServletOutputStream then
> write(ByteBuffer) will write using async IO, and invoke the write listener
> when done. Basically it will work the same as standard servlet async IO,
> but with byte buffers.
>
> Stuart
>
>
>> I was hoping someone might point me in the right direction of
>> replicating this behavior with Undertow's ServletOutputStreamImpl. It
>> does have a write(ByteBuffer) method, but it appears to be blocking. And
>> I was hoping there might be some XNIO abstraction for dealing with the
>> ReadableByteChannel, perhaps some example code somewhere?
>>
>> Any and all help/advice is appreciated!
>> Jim
>>
>> [1]: https://github.com/pedestal/pedestal
>> [2]:
>> http://grepcode.com/file/repo1.maven.org/maven2/org.
>> eclipse.jetty/jetty-server/9.2.0.v20140526/org/eclipse/
>> jetty/server/HttpOutput.java
>>
>> _______________________________________________
>> undertow-dev mailing list
>> undertow-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/undertow-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20140916/c1730987/attachment-0001.html 


More information about the undertow-dev mailing list