Class ObjectDownloadListener

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

    public class ObjectDownloadListener
    extends java.lang.Object
    implements javax.servlet.WriteListener
    Handle asynchronous large object download.
    Since:
    4.7
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.nio.ByteBuffer buffer  
      private javax.servlet.AsyncContext context  
      private java.nio.channels.ReadableByteChannel in  
      private static java.util.logging.Logger LOG  
      private javax.servlet.ServletOutputStream out  
      private java.nio.channels.WritableByteChannel outChannel  
      private javax.servlet.http.HttpServletResponse response  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void onError​(java.lang.Throwable e)
      Handle errors
      void onWritePossible()
      Write file content
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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
      • out

        private final javax.servlet.ServletOutputStream out
      • in

        private final java.nio.channels.ReadableByteChannel in
      • outChannel

        private final java.nio.channels.WritableByteChannel outChannel
      • buffer

        private java.nio.ByteBuffer buffer
    • Constructor Detail

      • ObjectDownloadListener

        public ObjectDownloadListener​(FileLfsRepository repository,
                                      javax.servlet.AsyncContext context,
                                      javax.servlet.http.HttpServletResponse response,
                                      AnyLongObjectId id)
                               throws java.io.IOException

        Constructor for ObjectDownloadListener.

        Parameters:
        repository - the repository storing large objects
        context - the servlet asynchronous context
        response - the servlet response
        id - id of the object to be downloaded
        Throws:
        java.io.IOException
    • Method Detail

      • onWritePossible

        public void onWritePossible()
                             throws java.io.IOException
        Write file content
        Specified by:
        onWritePossible in interface javax.servlet.WriteListener
        Throws:
        java.io.IOException
      • onError

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