use of org.eclipse.jgit.lib.ObjectLoader in project gitiles by GerritCodeReview.
the class RevisionServlet method doGetText.
@Override
protected void doGetText(HttpServletRequest req, HttpServletResponse res) throws IOException {
GitilesView view = ViewFilter.getView(req);
Repository repo = ServletUtils.getRepository(req);
try (ObjectReader reader = repo.newObjectReader()) {
ObjectLoader loader = reader.open(view.getRevision().getId());
if (loader.getType() != OBJ_COMMIT) {
res.setStatus(SC_NOT_FOUND);
} else {
PathServlet.setTypeHeader(res, loader.getType());
try (Writer writer = startRenderText(req, res);
OutputStream out = BaseEncoding.base64().encodingStream(writer)) {
loader.copyTo(out);
}
}
}
}
Aggregations