Class FileSender


  • final class FileSender
    extends java.lang.Object
    Dumps a file over HTTP GET (or its information via HEAD).

    Supports a single byte range requested via Range HTTP header. This feature supports a dumb client to resume download of a larger object file.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private long end  
      private long fileLen  
      private java.time.Instant lastModified  
      private java.io.File path  
      private long pos  
      private java.io.RandomAccessFile source  
    • Constructor Summary

      Constructors 
      Constructor Description
      FileSender​(java.io.File path)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void close()  
      (package private) java.time.Instant getLastModified()  
      private static java.util.Enumeration<java.lang.String> getRange​(javax.servlet.http.HttpServletRequest req)  
      (package private) java.lang.String getTailChecksum()  
      private boolean initRangeRequest​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp)  
      (package private) void serve​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse rsp, boolean sendBody)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • path

        private final java.io.File path
      • source

        private final java.io.RandomAccessFile source
      • lastModified

        private final java.time.Instant lastModified
      • fileLen

        private final long fileLen
      • pos

        private long pos
      • end

        private long end
    • Constructor Detail

      • FileSender

        FileSender​(java.io.File path)
            throws java.io.FileNotFoundException
        Throws:
        java.io.FileNotFoundException
    • Method Detail

      • close

        void close()
      • getLastModified

        java.time.Instant getLastModified()
      • getTailChecksum

        java.lang.String getTailChecksum()
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • serve

        void serve​(javax.servlet.http.HttpServletRequest req,
                   javax.servlet.http.HttpServletResponse rsp,
                   boolean sendBody)
            throws java.io.IOException
        Throws:
        java.io.IOException
      • initRangeRequest

        private boolean initRangeRequest​(javax.servlet.http.HttpServletRequest req,
                                         javax.servlet.http.HttpServletResponse rsp)
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • getRange

        private static java.util.Enumeration<java.lang.String> getRange​(javax.servlet.http.HttpServletRequest req)