Class AbstractMessageParser<T extends org.apache.http.HttpMessage>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.apache.http.message.LineParser lineParser  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract T createMessage​(org.apache.http.util.CharArrayBuffer buffer)
      Creates HttpMessage instance based on the content of the input buffer containing the first line of the incoming HTTP message.
      int fillBuffer​(java.nio.channels.ReadableByteChannel channel)
      Fills the internal buffer of the parser with input data from the given ReadableByteChannel.
      T parse()
      Attempts to parse a complete message head from the content of the internal buffer.
      void reset()
      Resets the parser.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • lineParser

        protected final org.apache.http.message.LineParser lineParser
    • Constructor Detail

      • AbstractMessageParser

        public AbstractMessageParser​(SessionInputBuffer buffer,
                                     org.apache.http.message.LineParser lineParser,
                                     org.apache.http.config.MessageConstraints constraints)
        Creates an instance of AbstractMessageParser.
        Parameters:
        buffer - the session input buffer.
        lineParser - the line parser. If null BasicLineParser.INSTANCE will be used.
        constraints - Message constraints. If null MessageConstraints.DEFAULT will be used.
        Since:
        4.3
    • Method Detail

      • reset

        public void reset()
        Description copied from interface: NHttpMessageParser
        Resets the parser. The parser will be ready to start parsing another HTTP message.
        Specified by:
        reset in interface NHttpMessageParser<T extends org.apache.http.HttpMessage>
      • fillBuffer

        public int fillBuffer​(java.nio.channels.ReadableByteChannel channel)
                       throws java.io.IOException
        Description copied from interface: NHttpMessageParser
        Fills the internal buffer of the parser with input data from the given ReadableByteChannel.
        Specified by:
        fillBuffer in interface NHttpMessageParser<T extends org.apache.http.HttpMessage>
        Parameters:
        channel - the input channel
        Returns:
        number of bytes read.
        Throws:
        java.io.IOException - in case of an I/O error.
      • createMessage

        protected abstract T createMessage​(org.apache.http.util.CharArrayBuffer buffer)
                                    throws org.apache.http.HttpException,
                                           org.apache.http.ParseException
        Creates HttpMessage instance based on the content of the input buffer containing the first line of the incoming HTTP message.
        Parameters:
        buffer - the line buffer.
        Returns:
        HTTP message.
        Throws:
        org.apache.http.HttpException - in case of HTTP protocol violation
        org.apache.http.ParseException - in case of a parse error.
      • parse

        public T parse()
                throws java.io.IOException,
                       org.apache.http.HttpException
        Description copied from interface: NHttpMessageParser
        Attempts to parse a complete message head from the content of the internal buffer. If the message in the input buffer is incomplete this method will return null.
        Specified by:
        parse in interface NHttpMessageParser<T extends org.apache.http.HttpMessage>
        Returns:
        HTTP message head, if available, null otherwise.
        Throws:
        java.io.IOException - in case of an I/O error.
        org.apache.http.HttpException - in case the HTTP message is malformed or violates the HTTP protocol.