Top Description Inners Fields Constructors Methods
org.eclipse.jgit.http.server.resolver

public Class AsIsFileService

extends Object
Class Inheritance
Imports
jakarta.servlet.http.HttpServletRequest, org.eclipse.jgit.lib.Config, .Repository, org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException, .ServiceNotEnabledException

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.getanyfile per-repository configuration setting, can be used by org.eclipse.jgit.http.server.GitServlet to control whether or not these older clients are permitted to read these direct files.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
public static final AsIsFileService

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
access(HttpServletRequest
current HTTP request, in case information from the request may help determine the access request.
req
,
Repository
the repository the request would obtain a bare file from.
db
)

Determine if access to any bare file of the repository is allowed.

protected static boolean

Returns:

false if http.getanyfile was explicitly set to false in the repository's configuration file; otherwise true.
isEnabled
(Repository
the repository to check.
db
)

Determine if http.getanyfile is enabled in the configuration.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DISABLEDback to summary
public static final AsIsFileService DISABLED

Always throws ServiceNotEnabledException.

Constructor Detail

AsIsFileServiceback to summary
public AsIsFileService()

Method Detail

accessback to summary
public void access(HttpServletRequest req, Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedException

Determine 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, throwing org.eclipse.jgit.transport.resolver.ServiceNotEnabledException if it was explicitly set to false, and otherwise succeeding silently.

Parameters
req:HttpServletRequest

current HTTP request, in case information from the request may help determine the access request.

db:Repository

the repository the request would obtain a bare file from.

Exceptions
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.
Since
7.0
isEnabledback to summary
protected static boolean isEnabled(Repository db)

Determine if http.getanyfile is enabled in the configuration.

Parameters
db:Repository

the repository to check.

Returns:boolean

false if http.getanyfile was explicitly set to false in the repository's configuration file; otherwise true.

org.eclipse.jgit.http.server.resolver back to summary

private Class AsIsFileService.ServiceConfig

extends Object
Class Inheritance
  • java.lang.Object
  • org.eclipse.jgit.http.server.resolver.AsIsFileService.ServiceConfig

Field Summary

Modifier and TypeField and Description
pack-priv final boolean

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

enabledback to summary
pack-priv final boolean enabled

Constructor Detail

ServiceConfigback to summary
pack-priv ServiceConfig(Config cfg)