Class ProtocolV2Parser


  • final class ProtocolV2Parser
    extends java.lang.Object
    Parse the incoming git protocol lines from the wire and translate them into a Request object. It requires a transferConfig object to know what the server supports (e.g. ref-in-want and/or filters).
    • Constructor Detail

      • ProtocolV2Parser

        ProtocolV2Parser​(TransferConfig transferConfig)
    • Method Detail

      • consumeCapabilities

        private static java.lang.String consumeCapabilities​(PacketLineIn pckIn,
                                                            java.util.function.Consumer<java.lang.String> serverOptionConsumer,
                                                            java.util.function.Consumer<java.lang.String> agentConsumer)
                                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • parseFetchRequest

        FetchV2Request parseFetchRequest​(PacketLineIn pckIn)
                                  throws PackProtocolException,
                                         java.io.IOException
        Parse the incoming fetch request arguments from the wire. The caller must be sure that what is comings is a fetch request before coming here.
        Parameters:
        pckIn - incoming lines
        Returns:
        A FetchV2Request populated with information received from the wire.
        Throws:
        PackProtocolException - incompatible options, wrong type of arguments or other issues where the request breaks the protocol.
        java.io.IOException - an IO error prevented reading the incoming message.
      • parseLsRefsRequest

        LsRefsV2Request parseLsRefsRequest​(PacketLineIn pckIn)
                                    throws PackProtocolException,
                                           java.io.IOException
        Parse the incoming ls-refs request arguments from the wire. This is meant for calling immediately after the caller has consumed a "command=ls-refs" line indicating the beginning of a ls-refs request. The incoming PacketLineIn is consumed until an END line, but the caller is responsible for closing it (if needed)
        Parameters:
        pckIn - incoming lines. This method will read until an END line.
        Returns:
        a LsRefsV2Request object with the data received in the wire.
        Throws:
        PackProtocolException - for inconsistencies in the protocol (e.g. unexpected lines)
        java.io.IOException - reporting problems reading the incoming messages from the wire