Class ObjectUploadListener

  • All Implemented Interfaces:
    java.util.EventListener, javax.servlet.ReadListener

    public class ObjectUploadListener
    extends java.lang.Object
    implements javax.servlet.ReadListener
    Handle asynchronous object upload.
    Since:
    4.6
    • Field Detail

      • LOG

        private static final java.util.logging.Logger LOG
      • context

        private final javax.servlet.AsyncContext context
      • response

        private final javax.servlet.http.HttpServletResponse response
      • in

        private final javax.servlet.ServletInputStream in
      • inChannel

        private final java.nio.channels.ReadableByteChannel inChannel
      • channel

        private java.nio.channels.WritableByteChannel channel
      • buffer

        private final java.nio.ByteBuffer buffer
      • path

        private final java.nio.file.Path path
      • uploaded

        private long uploaded
    • Constructor Detail

      • ObjectUploadListener

        public ObjectUploadListener​(FileLfsRepository repository,
                                    javax.servlet.AsyncContext context,
                                    javax.servlet.http.HttpServletRequest request,
                                    javax.servlet.http.HttpServletResponse response,
                                    AnyLongObjectId id)
                             throws java.io.FileNotFoundException,
                                    java.io.IOException
        Constructor for ObjectUploadListener.
        Parameters:
        repository - the repository storing large objects
        context - a AsyncContext object.
        request - a HttpServletRequest object.
        response - a HttpServletResponse object.
        id - a AnyLongObjectId object.
        Throws:
        java.io.FileNotFoundException
        java.io.IOException
    • Method Detail

      • onDataAvailable

        public void onDataAvailable()
                             throws java.io.IOException
        Writes all the received data to the output channel
        Specified by:
        onDataAvailable in interface javax.servlet.ReadListener
        Throws:
        java.io.IOException
      • onAllDataRead

        public void onAllDataRead()
                           throws java.io.IOException
        Specified by:
        onAllDataRead in interface javax.servlet.ReadListener
        Throws:
        java.io.IOException
      • close

        protected void close()
                      throws java.io.IOException
        Close resources held by this listener
        Throws:
        java.io.IOException
      • onError

        public void onError​(java.lang.Throwable e)
        Specified by:
        onError in interface javax.servlet.ReadListener