You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GitServlet.java 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright 2011 gitblit.com.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.gitblit.git;
  17. import javax.inject.Inject;
  18. import javax.servlet.ServletConfig;
  19. import javax.servlet.ServletException;
  20. import javax.servlet.http.HttpServletRequest;
  21. import com.gitblit.GitBlit;
  22. /**
  23. * The GitServlet provides http/https access to Git repositories.
  24. * Access to this servlet is protected by the GitFilter.
  25. *
  26. * @author James Moger
  27. *
  28. */
  29. public class GitServlet extends org.eclipse.jgit.http.server.GitServlet {
  30. private static final long serialVersionUID = 1L;
  31. private final GitBlit gitblit;
  32. @Inject
  33. public GitServlet(GitBlit gitblit) {
  34. super();
  35. this.gitblit = gitblit;
  36. }
  37. @Override
  38. public void init(ServletConfig config) throws ServletException {
  39. setRepositoryResolver(new RepositoryResolver<HttpServletRequest>(gitblit));
  40. setUploadPackFactory(new GitblitUploadPackFactory<HttpServletRequest>(gitblit));
  41. setReceivePackFactory(new GitblitReceivePackFactory<HttpServletRequest>(gitblit));
  42. super.init(config);
  43. }
  44. }