Top Description Inners Fields Constructors Methods
org.eclipse.jgit.transport

public Class HttpConfig

extends Object
Class Inheritance
Imports
java.io.IOException, java.net.URISyntaxException, java.text.MessageFormat, java.util.Arrays, .Collections, .List, .Set, java.util.function.Supplier, org.eclipse.jgit.annotations.NonNull, org.eclipse.jgit.errors.ConfigInvalidException, org.eclipse.jgit.internal.JGitText, org.eclipse.jgit.lib.Config, .StoredConfig, org.eclipse.jgit.util.StringUtils, .SystemReader, org.slf4j.Logger, .LoggerFactory

A representation of the "http.*" config values in a git org.eclipse.jgit.lib.Config. git provides for setting values for specific URLs through "http.<url>.*" subsections. git always considers only the initial original URL for such settings, not any redirected URL.
Since
4.9

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
HttpConfig.HttpRedirectMode

Config values for http.followRedirect.

Field Summary

Modifier and TypeField and Description
private String
private int
private static final int
private static final String
public static final String
EXTRA_HEADER

git config key for the "extraHeader" setting.

private List<String>
public static final String
FOLLOW_REDIRECTS_KEY

git config key for the "followRedirects" setting.

private HttpConfig.HttpRedirectMode
private static final String
public static final String
HTTP

git config section key for http settings.

private static final Logger
private static final String
private static final int
public static final String
MAX_REDIRECTS_KEY

git config key for the "maxRedirects" setting.

private int
public static final String
POST_BUFFER_KEY

git config key for the "postBuffer" setting.

private int
public static final String
SAVE_COOKIES_KEY

git config key for the "saveCookies" setting.

private boolean
public static final String
SSL_VERIFY_KEY

git config key for the "sslVerify" setting.

private boolean
public static final String
USER_AGENT

git config key for the "userAgent" setting.

private String

Constructor Summary

AccessConstructor and Description
public
HttpConfig(Config config, URIish
to get the configuration values for
uri
)

Creates a new org.eclipse.jgit.transport.HttpConfig tailored to the given org.eclipse.jgit.transport.URIish.

public
HttpConfig(URIish
to get the configuration values for
uri
)

Creates a org.eclipse.jgit.transport.HttpConfig that reads values solely from the user config.

Method Summary

Modifier and TypeMethod and Description
private boolean
private int
defaultedPort(int port, String scheme)

private int
private String

Returns:

the best matching subsection name, or null if no subsection matches
findMatch
(Set<String>
to match against the uri
names
,
URIish
to find a match for
uri
)

Determines the best match from a set of subsection names (representing prefix URLs) for the given URIish.

public String

Returns:

the value of the "http.cookieFile" setting
getCookieFile
()

Get the "http.cookieFile" setting

public int

Returns:

the value of the "http.cookieFileCacheLimit" setting
getCookieFileCacheLimit
()

Get the "http.cookieFileCacheLimit" setting (gives the maximum number of cookie files to keep in the LRU cache)

public List<String>

Returns:

the value of the "http.extraHeader" setting
getExtraHeaders
()

Get the "http.extraHeader" setting

public HttpConfig.HttpRedirectMode

Returns:

the value of the "http.followRedirects" setting
getFollowRedirects
()

Get the "http.followRedirects" setting

public int

Returns:

the value of the "http.maxRedirects" setting
getMaxRedirects
()

Get the "http.maxRedirects" setting

public int

Returns:

the value of the "http.postBuffer" setting
getPostBuffer
()

Get the "http.postBuffer" setting

public boolean

Returns:

the value of the "http.saveCookies" setting
getSaveCookies
()

Get the "http.saveCookies" setting

public String

Returns:

the value of the "http.userAgent" setting
getUserAgent
()

Get the "http.userAgent" setting

private void
init(Config config, URIish uri)

public boolean

Returns:

the value of the "http.sslVerify" setting
isSslVerify
()

Get the "http.sslVerify" setting

pack-priv static String
pack-priv static int
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cookieFileback to summary
private String cookieFile
cookieFileCacheLimitback to summary
private int cookieFileCacheLimit
DEFAULT_MAX_REDIRECTSback to summary
private static final int DEFAULT_MAX_REDIRECTS
ENV_HTTP_USER_AGENTback to summary
private static final String ENV_HTTP_USER_AGENT
EXTRA_HEADERback to summary
public static final String EXTRA_HEADER

git config key for the "extraHeader" setting.

Since
5.10
extraHeadersback to summary
private List<String> extraHeaders
FOLLOW_REDIRECTS_KEYback to summary
public static final String FOLLOW_REDIRECTS_KEY

git config key for the "followRedirects" setting.

followRedirectsback to summary
private HttpConfig.HttpRedirectMode followRedirects
FTPback to summary
private static final String FTP
HTTPback to summary
public static final String HTTP

git config section key for http settings.

LOGback to summary
private static final Logger LOG
MAX_REDIRECT_SYSTEM_PROPERTYback to summary
private static final String MAX_REDIRECT_SYSTEM_PROPERTY
MAX_REDIRECTSback to summary
private static final int MAX_REDIRECTS
MAX_REDIRECTS_KEYback to summary
public static final String MAX_REDIRECTS_KEY

git config key for the "maxRedirects" setting.

maxRedirectsback to summary
private int maxRedirects
POST_BUFFER_KEYback to summary
public static final String POST_BUFFER_KEY

git config key for the "postBuffer" setting.

postBufferback to summary
private int postBuffer
SAVE_COOKIES_KEYback to summary
public static final String SAVE_COOKIES_KEY

git config key for the "saveCookies" setting.

Since
5.4
saveCookiesback to summary
private boolean saveCookies
SSL_VERIFY_KEYback to summary
public static final String SSL_VERIFY_KEY

git config key for the "sslVerify" setting.

sslVerifyback to summary
private boolean sslVerify
USER_AGENTback to summary
public static final String USER_AGENT

git config key for the "userAgent" setting.

Since
5.10
userAgentback to summary
private String userAgent

Constructor Detail

HttpConfigback to summary
public HttpConfig(Config config, URIish uri)

Creates a new org.eclipse.jgit.transport.HttpConfig tailored to the given org.eclipse.jgit.transport.URIish.

Parameters
config:Config

to read the org.eclipse.jgit.transport.HttpConfig from

uri:URIish

to get the configuration values for

HttpConfigback to summary
public HttpConfig(URIish uri)

Creates a org.eclipse.jgit.transport.HttpConfig that reads values solely from the user config.

Parameters
uri:URIish

to get the configuration values for

Method Detail

compareback to summary
private boolean compare(String a, String b)
defaultedPortback to summary
private int defaultedPort(int port, String scheme)
findLastEmptyback to summary
private int findLastEmpty(String[] values)
findMatchback to summary
private String findMatch(Set<String> names, URIish uri)

Determines the best match from a set of subsection names (representing prefix URLs) for the given URIish.

Parameters
names:Set<String>

to match against the uri

uri:URIish

to find a match for

Returns:String

the best matching subsection name, or null if no subsection matches

getCookieFileback to summary
public String getCookieFile()

Get the "http.cookieFile" setting

Returns:String

the value of the "http.cookieFile" setting

Since
5.4
getCookieFileCacheLimitback to summary
public int getCookieFileCacheLimit()

Get the "http.cookieFileCacheLimit" setting (gives the maximum number of cookie files to keep in the LRU cache)

Returns:int

the value of the "http.cookieFileCacheLimit" setting

Since
5.4
getExtraHeadersback to summary
public List<String> getExtraHeaders()

Get the "http.extraHeader" setting

Returns:List<String>

the value of the "http.extraHeader" setting

Annotations
@NonNull
Since
5.10
getFollowRedirectsback to summary
public HttpConfig.HttpRedirectMode getFollowRedirects()

Get the "http.followRedirects" setting

Returns:HttpConfig.HttpRedirectMode

the value of the "http.followRedirects" setting

getMaxRedirectsback to summary
public int getMaxRedirects()

Get the "http.maxRedirects" setting

Returns:int

the value of the "http.maxRedirects" setting

getPostBufferback to summary
public int getPostBuffer()

Get the "http.postBuffer" setting

Returns:int

the value of the "http.postBuffer" setting

getSaveCookiesback to summary
public boolean getSaveCookies()

Get the "http.saveCookies" setting

Returns:boolean

the value of the "http.saveCookies" setting

Since
5.4
getUserAgentback to summary
public String getUserAgent()

Get the "http.userAgent" setting

Returns:String

the value of the "http.userAgent" setting

Since
5.10
initback to summary
private void init(Config config, URIish uri)
isSslVerifyback to summary
public boolean isSslVerify()

Get the "http.sslVerify" setting

Returns:boolean

the value of the "http.sslVerify" setting

normalizeback to summary
pack-priv static String normalize(String path)
segmentCompareback to summary
pack-priv static int segmentCompare(String uriPath, String m)
org.eclipse.jgit.transport back to summary

public final Enum HttpConfig.HttpRedirectMode

extends Enum<HttpConfig.HttpRedirectMode>
implements ConfigEnum
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.lib.Config.ConfigEnum

Config values for http.followRedirect.

Field Summary

Modifier and TypeField and Description
private final String
public static final HttpConfig.HttpRedirectMode
FALSE

Never follow redirects.

public static final HttpConfig.HttpRedirectMode
INITIAL

Only follow redirects on the initial GET request.

public static final HttpConfig.HttpRedirectMode
TRUE

Always follow redirects (up to the http.maxRedirects limit).

Constructor Summary

AccessConstructor and Description
private
HttpRedirectMode(String configValue)

Method Summary

Modifier and TypeMethod and Description
public boolean
matchConfigValue(String
the string to match
s
)

Implements org.eclipse.jgit.lib.Config.ConfigEnum.matchConfigValue.

Checks if the given string matches with enum value.

public String
toConfigValue()

Implements org.eclipse.jgit.lib.Config.ConfigEnum.toConfigValue.

Converts enumeration value into a string to be save in config.

public static HttpConfig.HttpRedirectMode
public static HttpConfig.HttpRedirectMode[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

configValueback to summary
private final String configValue
FALSEback to summary
public static final HttpConfig.HttpRedirectMode FALSE

Never follow redirects.

INITIALback to summary
public static final HttpConfig.HttpRedirectMode INITIAL

Only follow redirects on the initial GET request. This is the default.

TRUEback to summary
public static final HttpConfig.HttpRedirectMode TRUE

Always follow redirects (up to the http.maxRedirects limit).

Constructor Detail

HttpRedirectModeback to summary
private HttpRedirectMode(String configValue)

Method Detail

matchConfigValueback to summary
public boolean matchConfigValue(String s)

Implements org.eclipse.jgit.lib.Config.ConfigEnum.matchConfigValue.

Doc from org.eclipse.jgit.lib.Config.ConfigEnum.matchConfigValue.

Checks if the given string matches with enum value.

Parameters
s:String

the string to match

Returns:boolean

true if the given string matches enum value, false otherwise

Annotations
@Override
toConfigValueback to summary
public String toConfigValue()

Implements org.eclipse.jgit.lib.Config.ConfigEnum.toConfigValue.

Doc from org.eclipse.jgit.lib.Config.ConfigEnum.toConfigValue.

Converts enumeration value into a string to be save in config.

Returns:String

the enum value as config string

Annotations
@Override
valueOfback to summary
public static HttpConfig.HttpRedirectMode valueOf(String name)
valuesback to summary
public static HttpConfig.HttpRedirectMode[] values()