MINA
  1. MINA
  2. DIRMINA-601

Add sendfile support to transport-apr

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.0-M2
    • Fix Version/s: 2.0.8
    • Component/s: Core, Transport
    • Labels:
      None

      Description

      I've take a shot at adding support for sendfile to transport-apr. I've had to make several changes because in the current code FileRegion is NIO specific because of it's reliance on FileChannel. I've made the following changes:

      I've created an interface called SendableFile to take the place of using FileChannel in FileRegion. I've also created two implementations of this interface, AprSendableFile and NioSendableFile. The method of interest is send(long position, long length) which is used to send the file. Notice it doesn't take an IoSession or a Channel as a parameter. I tried using generics to include the proper subclass of IoSession but that didn't work out very well.

      There are still a couple of problems that need to be dealt with. First and foremost is that AbstractIoSession will create instances of DefaultFileRegion in the write method when passed either a File or a FileChannel. This causes a problem because FileRegion is no longer NIO specific. I don't have a solution right now other than removing the code.

      The other problem is with FileRegionWriteFilter (and unit test), again because FileRegion is NIO specific and exposes a FileChannel.

      I'm hoping somebody can take a look at the code and provide some feedback if they believe this is headed in the right direction or have a better idea. I'll attach the patches shortly.

        Activity

        Geoff Cadien created issue -
        Geoff Cadien made changes -
        Field Original Value New Value
        Attachment sendfile-patches.zip [ 12383476 ]
        Geoff Cadien made changes -
        Attachment sendfile-patches.zip [ 12383497 ]
        Geoff Cadien made changes -
        Attachment sendfile-patches.zip [ 12383476 ]
        Geoff Cadien made changes -
        Attachment sendfile-patches.zip [ 12383876 ]
        Geoff Cadien made changes -
        Attachment sendfile-patches.zip [ 12383497 ]
        Emmanuel Lecharny made changes -
        Fix Version/s 3.0.0-M1 [ 12313531 ]
        Julien Vermillard made changes -
        Fix Version/s 2.0.6 [ 12316652 ]
        Fix Version/s 3.0.0-M1 [ 12313531 ]
        Emmanuel Lecharny made changes -
        Fix Version/s 2.0.8 [ 12323342 ]
        Fix Version/s 2.0.6 [ 12316652 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Geoff Cadien
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Development