public class UserAgent
extends java.lang.Object
On HTTP transports this user agent string is always supplied by the JGit
client in the User-Agent
HTTP header.
On native transports this user agent string is always sent when JGit is a server. When JGit is a client the user agent string will be supplied to the remote server only if the remote server advertises its own agent identity.
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
userAgent |
Modifier | Constructor and Description |
---|---|
private |
UserAgent() |
Modifier and Type | Method and Description |
---|---|
private static java.lang.String |
clean(java.lang.String s) |
private static java.lang.String |
computeUserAgent() |
private static java.lang.String |
computeVersion() |
static java.lang.String |
get()
Get the user agent string advertised by JGit.
|
(package private) static java.lang.String |
getAgent(java.util.Set<java.lang.String> options,
java.lang.String transportAgent) |
(package private) static boolean |
hasAgent(java.util.Set<java.lang.String> options) |
static void |
set(java.lang.String agent)
Change the user agent string advertised by JGit.
|
private static java.lang.String computeUserAgent()
private static java.lang.String computeVersion()
private static java.lang.String clean(java.lang.String s)
public static java.lang.String get()
"JGit/4.0"
; null if the agent has
been cleared and should not be shared with a peer.public static void set(java.lang.String agent)
The new string should start with "JGit/"
(for example
"JGit/4.0"
) to advertise the implementation as JGit based.
Spaces and other whitespace should be avoided as these will be
automatically converted to "."
.
User agent strings are restricted to printable ASCII.
agent
- new user agent string for this running JGit library. Setting
to null or empty string will avoid sending any identification
to the peer.static java.lang.String getAgent(java.util.Set<java.lang.String> options, java.lang.String transportAgent)
static boolean hasAgent(java.util.Set<java.lang.String> options)