| | |
| | | import java.text.ParseException;
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.inject.Inject;
|
| | | import javax.inject.Singleton;
|
| | | import javax.servlet.ServletException;
|
| | | import javax.servlet.http.HttpServlet;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | |
| | | * @author James Moger
|
| | | *
|
| | | */
|
| | | @Singleton
|
| | | public class DownloadZipServlet extends HttpServlet {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | private transient Logger logger = LoggerFactory.getLogger(DownloadZipServlet.class);
|
| | |
|
| | | private final IStoredSettings settings;
|
| | |
|
| | | private final IRepositoryManager repositoryManager;
|
| | |
|
| | | public static enum Format {
|
| | | zip(".zip"), tar(".tar"), gz(".tar.gz"), xz(".tar.xz"), bzip2(".tar.bzip2");
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public DownloadZipServlet() {
|
| | | @Inject
|
| | | public DownloadZipServlet(
|
| | | IRuntimeManager runtimeManager,
|
| | | IRepositoryManager repositoryManager) {
|
| | |
|
| | | super();
|
| | | this.settings = runtimeManager.getSettings();
|
| | | this.repositoryManager = repositoryManager;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | private void processRequest(javax.servlet.http.HttpServletRequest request,
|
| | | javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException,
|
| | | java.io.IOException {
|
| | | IStoredSettings settings = GitBlit.getManager(IRuntimeManager.class).getSettings();
|
| | | if (!settings.getBoolean(Keys.web.allowZipDownloads, true)) {
|
| | | logger.warn("Zip downloads are disabled");
|
| | | response.sendError(HttpServletResponse.SC_FORBIDDEN);
|
| | |
| | | name += "-" + objectId;
|
| | | }
|
| | |
|
| | | IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);
|
| | | Repository r = repositoryManager.getRepository(repository);
|
| | | if (r == null) {
|
| | | if (repositoryManager.isCollectingGarbage(repository)) {
|