Package org.eclipse.jgit.lfs.server.fs
Class ObjectUploadListener
- java.lang.Object
-
- org.eclipse.jgit.lfs.server.fs.ObjectUploadListener
-
- All Implemented Interfaces:
java.util.EventListener,javax.servlet.ReadListener
public class ObjectUploadListener extends java.lang.Object implements javax.servlet.ReadListenerHandle asynchronous object upload.- Since:
- 4.6
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceObjectUploadListener.CallbackCallback invoked after object upload completed.
-
Field Summary
Fields Modifier and Type Field Description private java.nio.ByteBufferbufferprivate ObjectUploadListener.Callbackcallbackprivate java.nio.channels.WritableByteChannelchannelprivate javax.servlet.AsyncContextcontextprivate javax.servlet.ServletInputStreaminprivate java.nio.channels.ReadableByteChannelinChannelprivate static java.util.logging.LoggerLOGprivate AtomicObjectOutputStreamoutprivate java.nio.file.Pathpathprivate javax.servlet.http.HttpServletResponseresponseprivate longuploaded
-
Constructor Summary
Constructors Constructor Description ObjectUploadListener(FileLfsRepository repository, javax.servlet.AsyncContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, AnyLongObjectId id)Constructor for ObjectUploadListener.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidclose()Close resources held by this listenervoidonAllDataRead()voidonDataAvailable()Writes all the received data to the output channelvoidonError(java.lang.Throwable e)ObjectUploadListenersetCallback(ObjectUploadListener.Callback callback)Set the callback to invoke after upload completed.
-
-
-
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
-
out
private final AtomicObjectOutputStream out
-
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
-
callback
private ObjectUploadListener.Callback callback
-
-
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 objectscontext- aAsyncContextobject.request- aHttpServletRequestobject.response- aHttpServletResponseobject.id- aAnyLongObjectIdobject.- Throws:
java.io.FileNotFoundExceptionjava.io.IOException
-
-
Method Detail
-
setCallback
public ObjectUploadListener setCallback(ObjectUploadListener.Callback callback)
Set the callback to invoke after upload completed.- Parameters:
callback- the callback- Returns:
this.- Since:
- 5.1.7
-
onDataAvailable
public void onDataAvailable() throws java.io.IOExceptionWrites all the received data to the output channel- Specified by:
onDataAvailablein interfacejavax.servlet.ReadListener- Throws:
java.io.IOException
-
onAllDataRead
public void onAllDataRead() throws java.io.IOException- Specified by:
onAllDataReadin interfacejavax.servlet.ReadListener- Throws:
java.io.IOException
-
close
protected void close() throws java.io.IOExceptionClose resources held by this listener- Throws:
java.io.IOException
-
onError
public void onError(java.lang.Throwable e)
- Specified by:
onErrorin interfacejavax.servlet.ReadListener
-
-