Class BasicLineParser

  • All Implemented Interfaces:
    LineParser

    @Contract(threading=IMMUTABLE)
    public class BasicLineParser
    extends java.lang.Object
    implements LineParser
    Basic parser for lines in the head section of an HTTP message. There are individual methods for parsing a request line, a status line, or a header line. The lines to parse are passed in memory, the parser does not depend on any specific IO mechanism. Instances of this class are stateless and thread-safe. Derived classes MUST maintain these properties.

    Note: This class was created by refactoring parsing code located in various other classes. The author tags from those other classes have been replicated here, although the association with the parsing code taken from there has not been traced.

    Since:
    4.0
    • Field Detail

      • DEFAULT

        @Deprecated
        public static final BasicLineParser DEFAULT
        Deprecated.
        (4.3) use INSTANCE
        A default instance of this class, for use as default or fallback. Note that BasicLineParser is not a singleton, there can be many instances of the class itself and of derived classes. The instance here provides non-customized, default behavior.
      • protocol

        protected final ProtocolVersion protocol
        A version of the protocol to parse. The version is typically not relevant, but the protocol name.
    • Constructor Detail

      • BasicLineParser

        public BasicLineParser​(ProtocolVersion proto)
        Creates a new line parser for the given HTTP-like protocol.
        Parameters:
        proto - a version of the protocol to parse, or null for HTTP. The actual version is not relevant, only the protocol name.
      • BasicLineParser

        public BasicLineParser()
        Creates a new line parser for HTTP.