[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jetty-users] ByteBuffers and Jetty?
|
Thanks for the responses, Jeff and Simone.
On May 1, 2012, at 8:03 AM, jetty-users-request@xxxxxxxxxxx wrote:
> Date: Mon, 30 Apr 2012 19:01:29 -0400
> From: Jeffrey Kesselman <jeffpk@xxxxxxxxx>
>
> What you want for hard memory access are NativeDirectByteBuffers
>
> These can ONLY be created from native code run through JNI. Once created
> they appear like any other ByteBuffer to the JVM.
Understood. I've got my JNI helmet on.
> On Mon, Apr 30, 2012 at 6:14 PM, Simone Bordet <sbordet@xxxxxxxxxxx> wrote:
>
>> Hi,
>>
>> On Sun, Apr 29, 2012 at 04:15, David Walend <david@xxxxxxxxxx> wrote:
>>> I'm working on a project where I need direct access to memory via
>> ByteBuffers and the ability to use http protocols to push the data around
>> the internet. Can Jetty do that? How hard is it to do?
>>>
>>> (An early aspect of this project is transferring ~10GB files. Does Jetty
>> have any baked-in limits on size of a single transfer?)
>>>
>>> I haven't been able to find doc or an email thread on ByteBuffers, so a
>> "go read this" answer would be great help. Heck, even "go read this part of
>> the source code" would be fine.
>>
>> Jetty's DefaultServlet is already doing a bunch of smart things
>> related to mapped file buffers and such, see
>>
>> http://wiki.eclipse.org/Jetty/Feature/Servlets_Bundled_with_Jetty#DefaultServlet
>> (in particular parameter "useFileMappedBuffer").
That's a terrific answer for the immediate project. To justify Jetty long-term I need to show what I'd have to do to access ByteBuffers of incoming data and supply ByteBuffers of outbound data.
How do I draw ByteBuffers out of an HttpRequest?
How do I push ByteBuffers into an HttpResponse?
In Request, it looks like Jetty can supply its own ByteBuffers in setAttribute(), but it doesn't look like API I should use. It looks like the ByteBuffers are just under the skin, maybe in AbstractHttpConnection, but I'm hesitant to use them without seeing them in some sort of obviously long-lived API. It won't be in the servlet API standard, but is there something in Jetty that I can count on not changing release to release?
Thanks,
Dave