public void doFilter(ServletRequest request, ServletResponse response,
FilterChain next) throws IOException, ServletException {
// The Resolver above already checked READ access for us.
Repository repo = ServletUtils.getRepository(request);
ProjectControl pc = (ProjectControl) request.getAttribute(ATT_CONTROL);
UploadPack up = (UploadPack) request.getAttribute(ServletUtils.ATTRIBUTE_HANDLER);
if (!pc.canRunUploadPack()) {
GitSmartHttpTools.sendError((HttpServletRequest) request,
(HttpServletResponse) response, HttpServletResponse.SC_FORBIDDEN,
"upload-pack not permitted on this server");
return;
}
if (!pc.allRefsAreVisible()) {
up.setAdvertiseRefsHook(new VisibleRefFilter(tagCache, repo, pc, db.get(), true));
}
next.doFilter(request, response);
}