List of usage examples for org.eclipse.jgit.lfs.server.internal LfsServerText get
public static LfsServerText get()
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;//from w w w. ja v a 2s .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)); }
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(); }/* w w w.j a va 2 s. c om*/ 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); }