Module org.eclipse.jgit.http.server
Class AsIsFileService
- java.lang.Object
-
- org.eclipse.jgit.http.server.resolver.AsIsFileService
-
public class AsIsFileService extends Object
Controls access to bare files in a repository.Older HTTP clients which do not speak the smart HTTP variant of the Git protocol fetch from a repository by directly getting its objects and pack files. This class, along with the
http.getanyfileper-repository configuration setting, can be used byGitServletto control whether or not these older clients are permitted to read these direct files.
-
-
Field Summary
Fields Modifier and Type Field Description static AsIsFileServiceDISABLEDAlways throwsServiceNotEnabledException.
-
Constructor Summary
Constructors Constructor Description AsIsFileService()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccess(javax.servlet.http.HttpServletRequest req, Repository db)Determine if access to any bare file of the repository is allowed.protected static booleanisEnabled(Repository db)Determine ifhttp.getanyfileis enabled in the configuration.
-
-
-
Field Detail
-
DISABLED
public static final AsIsFileService DISABLED
Always throwsServiceNotEnabledException.
-
-
Method Detail
-
isEnabled
protected static boolean isEnabled(Repository db)
Determine ifhttp.getanyfileis enabled in the configuration.- Parameters:
db- the repository to check.- Returns:
falseifhttp.getanyfilewas explicitly set tofalsein the repository's configuration file; otherwisetrue.
-
access
public void access(javax.servlet.http.HttpServletRequest req, Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedExceptionDetermine if access to any bare file of the repository is allowed.This method silently succeeds if the request is allowed, or fails by throwing a checked exception if access should be denied.
The default implementation of this method checks
http.getanyfile, throwingServiceNotEnabledExceptionif it was explicitly set tofalse, and otherwise succeeding silently.- Parameters:
req- current HTTP request, in case information from the request may help determine the access request.db- the repository the request would obtain a bare file from.- Throws:
ServiceNotEnabledException- bare file access is not allowed on the target repository, by any user, for any reason.ServiceNotAuthorizedException- bare file access is not allowed for this HTTP request and repository, such as due to a permission error.
-
-