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

public Class UserAgent

extends Object
Class Inheritance
Imports
org.eclipse.jgit.util.StringUtils

User agent to be reported by this JGit client and server on the network.

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.

Since
4.0

Field Summary

Modifier and TypeField and Description
private static volatile String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static String
private static String
private static String
public static String

Returns:

a string similar to "JGit/4.0"; null if the agent has been cleared and should not be shared with a peer.
get
()

Get the user agent string advertised by JGit.

public static void
set(String
new user agent string for this running JGit library. Setting to null or empty string will avoid sending any identification to the peer.
agent
)

Change the user agent string advertised by JGit.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

userAgentback to summary
private static volatile String userAgent

Constructor Detail

UserAgentback to summary
private UserAgent()

Method Detail

cleanback to summary
pack-priv static String clean(String s)
computeUserAgentback to summary
private static String computeUserAgent()
computeVersionback to summary
private static String computeVersion()
getback to summary
public static String get()

Get the user agent string advertised by JGit.

Returns:String

a string similar to "JGit/4.0"; null if the agent has been cleared and should not be shared with a peer.

setback to summary
public static void set(String agent)

Change the user agent string advertised by JGit.

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.

Parameters
agent:String

new user agent string for this running JGit library. Setting to null or empty string will avoid sending any identification to the peer.