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

public Class FirstWant

extends Object
Class Inheritance
Static Imports
org.eclipse.jgit.transport.GitProtocolConstants.OPTION_AGENT, .GitProtocolConstants.OPTION_SESSION_ID

In the pack negotiation phase (protocol v0/v1), the client sends a list of wants. The first "want" line is special, as it (can) have a list of capabilities appended. E.g. "want oid cap1 cap2 cap3" Do not confuse this line with the first one in the reference advertisement, which is sent by the server, looks like "b8f7c471373b8583ced0025cfad8c9916c484b76 HEAD\0 cap1 cap2 cap3" and is parsed by the BasePackConnection.readAdvertisedRefs method. This class parses the input want line and holds the results: the actual want line and the capabilities.

Field Summary

Modifier and TypeField and Description
private final String
private static final String
private final Set<String>
private final String
private final String
private static final String

Constructor Summary

AccessConstructor and Description
private
FirstWant(String line, Set<String> capabilities, String agent, String clientSID)

Method Summary

Modifier and TypeMethod and Description
public static FirstWant

Returns:

an instance of FirstWant
fromLine
(String
line from the client.
line
)

Parse the first want line in the protocol v0/v1 pack negotiation.

public String

Returns:

client user agent parsed from the line.
getAgent
()

Get agent

public Set<String>

Returns:

capabilities parsed from the line as an immutable set (excluding agent and session-id).
getCapabilities
()

Get capabilities

public String

Returns:

client session-id parsed from the line.
getClientSID
()

Get client session-id

public String

Returns:

non-capabilities part of the line.
getLine
()

Get line

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

agentback to summary
private final String agent
Annotations
@Nullable
AGENT_PREFIXback to summary
private static final String AGENT_PREFIX
capabilitiesback to summary
private final Set<String> capabilities
clientSIDback to summary
private final String clientSID
Annotations
@Nullable
lineback to summary
private final String line
SESSION_ID_PREFIXback to summary
private static final String SESSION_ID_PREFIX

Constructor Detail

FirstWantback to summary
private FirstWant(String line, Set<String> capabilities, String agent, String clientSID)

Method Detail

fromLineback to summary
public static FirstWant fromLine(String line) throws PackProtocolException

Parse the first want line in the protocol v0/v1 pack negotiation.

Parameters
line:String

line from the client.

Returns:FirstWant

an instance of FirstWant

Exceptions
PackProtocolException:
if the line doesn't follow the protocol format.
getAgentback to summary
public String getAgent()

Get agent

Returns:String

client user agent parsed from the line.

Annotations
@Nullable
getCapabilitiesback to summary
public Set<String> getCapabilities()

Get capabilities

Returns:Set<String>

capabilities parsed from the line as an immutable set (excluding agent and session-id).

getClientSIDback to summary
public String getClientSID()

Get client session-id

Returns:String

client session-id parsed from the line.

Annotations
@Nullable
getLineback to summary
public String getLine()

Get line

Returns:String

non-capabilities part of the line.