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.ReadListener
Handle asynchronous object upload.- Since:
- 4.6
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ObjectUploadListener.Callback
Callback invoked after object upload completed.
-
Field Summary
Fields Modifier and Type Field Description private java.nio.ByteBuffer
buffer
private ObjectUploadListener.Callback
callback
private java.nio.channels.WritableByteChannel
channel
private javax.servlet.AsyncContext
context
private javax.servlet.ServletInputStream
in
private java.nio.channels.ReadableByteChannel
inChannel
private static java.util.logging.Logger
LOG
private AtomicObjectOutputStream
out
private java.nio.file.Path
path
private javax.servlet.http.HttpServletResponse
response
private long
uploaded
-
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 void
close()
Close resources held by this listenervoid
onAllDataRead()
void
onDataAvailable()
Writes all the received data to the output channelvoid
onError(java.lang.Throwable e)
ObjectUploadListener
setCallback(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
- aAsyncContext
object.request
- aHttpServletRequest
object.response
- aHttpServletResponse
object.id
- aAnyLongObjectId
object.- Throws:
java.io.FileNotFoundException
java.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.IOException
Writes all the received data to the output channel- Specified by:
onDataAvailable
in interfacejavax.servlet.ReadListener
- Throws:
java.io.IOException
-
onAllDataRead
public void onAllDataRead() throws java.io.IOException
- Specified by:
onAllDataRead
in interfacejavax.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 interfacejavax.servlet.ReadListener
-
-