Package org.jenkinsci.plugins.gitserver
Class HttpGitRepository
java.lang.Object
org.jenkinsci.plugins.gitserver.HttpGitRepository
- Direct Known Subclasses:
FileBackedHttpGitRepository
UI-bound object that exposes a Git repository via HTTP.
To expose a Git repository, bind this object to the URL space via stapler,
for example by adding a getter to your Action
object.
- Author:
- Kohsuke Kawaguchi
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
to make sure the user has the permission to pull.abstract org.eclipse.jgit.transport.ReceivePack
createReceivePack
(javax.servlet.http.HttpServletRequest context, org.eclipse.jgit.lib.Repository db) Returns theReceivePack
that handles "git push" from client.abstract org.eclipse.jgit.transport.UploadPack
createUploadPack
(javax.servlet.http.HttpServletRequest context, org.eclipse.jgit.lib.Repository db) Returns theUploadPack
that handles "git fetch" from client.void
doDynamic
(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) Handles git smart HTTP protocol.protected org.eclipse.jgit.http.server.GitServlet
init()
abstract org.eclipse.jgit.lib.Repository
Opens the repository this UI-bound object holds on to.
-
Constructor Details
-
HttpGitRepository
public HttpGitRepository()
-
-
Method Details
-
openRepository
Opens the repository this UI-bound object holds on to.- Throws:
IOException
-
createReceivePack
public abstract org.eclipse.jgit.transport.ReceivePack createReceivePack(javax.servlet.http.HttpServletRequest context, org.eclipse.jgit.lib.Repository db) throws org.eclipse.jgit.transport.resolver.ServiceNotEnabledException, org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException Returns theReceivePack
that handles "git push" from client. The most basic implementation is the following, which allows anyone to push to this repository, so normally you want some kind of access check before that.DefaultReceivePackFactory
isn't suitable here because it requires that the user has non-empty name, which isn't necessarily true in Jenkins (for example, when the security is off entirely.)return new ReceivePack(db);
- Throws:
org.eclipse.jgit.transport.resolver.ServiceNotEnabledException
org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException
- See Also:
-
ReceivePackFactory.create(Object, Repository)
-
createUploadPack
public abstract org.eclipse.jgit.transport.UploadPack createUploadPack(javax.servlet.http.HttpServletRequest context, org.eclipse.jgit.lib.Repository db) throws org.eclipse.jgit.transport.resolver.ServiceNotEnabledException, org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException Returns theUploadPack
that handles "git fetch" from client. The most basic implementation is the following, which exposes this repository to everyone.return new DefaultUploadPackFactory().create(context,db);
- Throws:
org.eclipse.jgit.transport.resolver.ServiceNotEnabledException
org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException
- See Also:
-
UploadPackFactory.create(Object, Repository)
-
checkPullPermission
public void checkPullPermission()to make sure the user has the permission to pull. -
init
protected org.eclipse.jgit.http.server.GitServlet init() -
doDynamic
public void doDynamic(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException Handles git smart HTTP protocol.- Throws:
IOException
javax.servlet.ServletException
-