You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by 이희승 (Trustin Lee) <t...@gmail.com> on 2008/04/20 06:42:50 UTC

Re: HTTP Codec + FileRegion + Large File Transfer

Hello Michaël,

ProtocolCodecFilter doesn't understand File, FileChannel or FileRegion
at all.  It is directly written by I/O processor.  If you are going to
utilize this native function, it should work independently from your
codec, which means your protocol should be designed to work with
FileChannel.transerTo().

As an alternative, you can use a FileRegionWriteFilter although it's
somewhat inefficient comparing to the native function.

HTH,

Michaël Schwartz wrote:
> Hello all !
> 
> 
> I'm working on the HTTP Codec , I'd see that in asyncweb there is no
> efficient way to attach a file in the response message.
> So I'm writing the http response message like this :
> 
> session.write(httpMessage);
> 
> without body part.
> 
> And then
> 
> session.write(myfile);
> 
> My file is transfered via the FileChannel.transferTo + FileRegion
> process included in mina 2.0
> 
> It works good but i want to add this mechanism in my codec. How can i do ?
> 
> Second thing , how the file transfer is processed ? do i need to add an
> executor filter for simultaneous file transfers ?
> 
> Thanks a lot in advance.

-- 
Trustin Lee - Principal Software Engineer, JBoss, Red Hat
--
what we call human nature is actually human habit
--
http://gleamynode.net/