Class FirstWant


  • public class FirstWant
    extends Object
    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.
    • Method Detail

      • fromLine

        public static FirstWant fromLine​(String line)
                                  throws PackProtocolException
        Parse the first want line in the protocol v0/v1 pack negotiation.
        Parameters:
        line - line from the client.
        Returns:
        an instance of FirstWant
        Throws:
        PackProtocolException - if the line doesn't follow the protocol format.
      • getLine

        public String getLine()
        Returns:
        non-capabilities part of the line.
      • getCapabilities

        public Set<String> getCapabilities()
        Returns:
        capabilities parsed from the line as an immutable set (excluding agent).
      • getAgent

        @Nullable
        public String getAgent()
        Returns:
        client user agent parsed from the line.