Example usage for org.eclipse.jgit.lfs.server.fs ObjectUploadListener ObjectUploadListener

List of usage examples for org.eclipse.jgit.lfs.server.fs ObjectUploadListener ObjectUploadListener

Introduction

In this page you can find the example usage for org.eclipse.jgit.lfs.server.fs ObjectUploadListener ObjectUploadListener.

Prototype

public ObjectUploadListener(FileLfsRepository repository, AsyncContext context, HttpServletRequest request,
        HttpServletResponse response, AnyLongObjectId id) throws FileNotFoundException, IOException 

Source Link

Document

Constructor for ObjectUploadListener.

Usage

From source file:com.googlesource.gerrit.plugins.lfs.fs.LfsFsContentServlet.java

License:Apache License

@Override
protected void doPut(HttpServletRequest req, HttpServletResponse rsp) throws ServletException, IOException {
    AnyLongObjectId id = getObjectToTransfer(req, rsp);
    if (id == null) {
        return;//w w w. ja  v a2 s.  c  om
    }

    if (!authorizer.verifyAuthInfo(req.getHeader(HDR_AUTHORIZATION), UPLOAD, id)) {
        sendError(rsp, HttpStatus.SC_UNAUTHORIZED,
                MessageFormat.format(LfsServerText.get().failedToCalcSignature, "Invalid authorization token"));
        return;
    }

    AsyncContext context = req.startAsync();
    context.setTimeout(timeout);
    req.getInputStream().setReadListener(new ObjectUploadListener(repository, context, req, rsp, id));
}