Package org.eclipse.jgit.http.server
Class GitFilter
- java.lang.Object
-
- org.eclipse.jgit.http.server.glue.MetaFilter
-
- org.eclipse.jgit.http.server.GitFilter
-
- All Implemented Interfaces:
javax.servlet.Filter
public class GitFilter extends MetaFilter
Handles Git repository access over HTTP.Applications embedding this filter should map a directory path within the application to this filter. For a servlet version, see
GitServlet
.Applications may wish to add additional repository action URLs to this servlet by taking advantage of its extension from
MetaFilter
. Callers may register their own URL suffix translations throughMetaFilter.serve(String)
, or their regex translations throughMetaFilter.serveRegex(String)
. Each translation should contain a complete filter pipeline which ends with the HttpServlet that should handle the requested action.
-
-
Constructor Summary
Constructors Constructor Description GitFilter()
New servlet that will load its base directory fromweb.xml
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addReceivePackFilter(javax.servlet.Filter filter)
Add receive-pack filtervoid
addUploadPackFilter(javax.servlet.Filter filter)
Add upload-pack filtervoid
init(javax.servlet.FilterConfig filterConfig)
protected ServletBinder
register(ServletBinder binder)
Configure a newly created binder.void
setAsIsFileService(AsIsFileService f)
Set AsIsFileServicevoid
setReceivePackErrorHandler(ReceivePackErrorHandler h)
Set a custom error handler for git-receive-pack.void
setReceivePackFactory(ReceivePackFactory<javax.servlet.http.HttpServletRequest> f)
Set the receive-pack factoryvoid
setRepositoryResolver(RepositoryResolver<javax.servlet.http.HttpServletRequest> resolver)
New servlet configured with a specific resolver.void
setUploadPackErrorHandler(UploadPackErrorHandler h)
Set a custom error handler for git-upload-pack.void
setUploadPackFactory(UploadPackFactory<javax.servlet.http.HttpServletRequest> f)
Set upload-pack factory-
Methods inherited from class org.eclipse.jgit.http.server.glue.MetaFilter
destroy, doFilter, serve, serveRegex, serveRegex
-
-
-
-
Method Detail
-
setRepositoryResolver
public void setRepositoryResolver(RepositoryResolver<javax.servlet.http.HttpServletRequest> resolver)
New servlet configured with a specific resolver.- Parameters:
resolver
- the resolver to use when matching URL to Git repository. If null thebase-path
parameter will be looked for in the parameter table during init, which usually comes from theweb.xml
file of the web application.
-
setAsIsFileService
public void setAsIsFileService(AsIsFileService f)
Set AsIsFileService- Parameters:
f
- the filter to validate direct access to repository files through a dumb client. Ifnull
then dumb client support is completely disabled.
-
setUploadPackFactory
public void setUploadPackFactory(UploadPackFactory<javax.servlet.http.HttpServletRequest> f)
Set upload-pack factory- Parameters:
f
- the factory to construct and configure anUploadPack
session when a fetch or clone is requested by a client.
-
setUploadPackErrorHandler
public void setUploadPackErrorHandler(UploadPackErrorHandler h)
Set a custom error handler for git-upload-pack.- Parameters:
h
- A custom error handler for git-upload-pack.- Since:
- 5.6
-
addUploadPackFilter
public void addUploadPackFilter(javax.servlet.Filter filter)
Add upload-pack filter- Parameters:
filter
- filter to apply before any of the UploadPack operations. The UploadPack instance is available in the request attributeServletUtils.ATTRIBUTE_HANDLER
.
-
setReceivePackFactory
public void setReceivePackFactory(ReceivePackFactory<javax.servlet.http.HttpServletRequest> f)
Set the receive-pack factory- Parameters:
f
- the factory to construct and configure aReceivePack
session when a push is requested by a client.
-
setReceivePackErrorHandler
public void setReceivePackErrorHandler(ReceivePackErrorHandler h)
Set a custom error handler for git-receive-pack.- Parameters:
h
- A custom error handler for git-receive-pack.- Since:
- 5.7
-
addReceivePackFilter
public void addReceivePackFilter(javax.servlet.Filter filter)
Add receive-pack filter- Parameters:
filter
- filter to apply before any of the ReceivePack operations. The ReceivePack instance is available in the request attributeServletUtils.ATTRIBUTE_HANDLER
.
-
init
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
- Specified by:
init
in interfacejavax.servlet.Filter
- Overrides:
init
in classMetaFilter
- Throws:
javax.servlet.ServletException
-
register
protected ServletBinder register(ServletBinder binder)
Configure a newly created binder.- Overrides:
register
in classMetaFilter
- Parameters:
binder
- the newly created binder.- Returns:
- binder for the caller, potentially after adding one or more filters into the pipeline.
-
-