Example usage for org.eclipse.jgit.lfs.lib AnyLongObjectId getName

List of usage examples for org.eclipse.jgit.lfs.lib AnyLongObjectId getName

Introduction

In this page you can find the example usage for org.eclipse.jgit.lfs.lib AnyLongObjectId getName.

Prototype

public final String getName() 

Source Link

Document

Get string form of the SHA-256

Usage

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

License:Apache License

private Optional<AnyLongObjectId> validateGetRequest(HttpServletRequest req, HttpServletResponse rsp)
        throws IOException {
    AnyLongObjectId obj = getObjectToTransfer(req, rsp);
    if (obj == null) {
        return Optional.empty();
    }/*from   w w w.  j  a  v a2  s .com*/

    if (repository.getSize(obj) == -1) {
        sendError(rsp, HttpStatus.SC_NOT_FOUND,
                MessageFormat.format(LfsServerText.get().objectNotFound, obj.getName()));
        return Optional.empty();
    }

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