Class ContentParser

  • Direct Known Subclasses:
    BeginRequestContentParser, EndRequestContentParser, ParamsContentParser, StreamContentParser

    public abstract class ContentParser
    extends java.lang.Object

    Parser for FastCGI frame content.

    Depending on the frame type specified in the FastCGI frame header, the FastCGI frame content has different formats and it is parsed by different implementation of this abstract class.

    There are these frame content types:

    • BEGIN_REQUEST, to signal the begin of the request
    • PARAMS, key/value pairs
    • STDIN, the request body, handled as a stream
    • STDOUT, the response body, handled as a stream
    • STDERR, the response error, handled as a stream
    • END_REQUEST, to signal the end of the response
    See Also:
    Parser
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ContentParser.Result
      The result of the frame content parsing.
    • Constructor Detail

      • ContentParser

        protected ContentParser​(HeaderParser headerParser)
    • Method Detail

      • parse

        public abstract ContentParser.Result parse​(java.nio.ByteBuffer buffer)

        Parses the bytes in the given buffer as FastCGI frame content bytes.

        Parameters:
        buffer - the bytes to parse
        Returns:
        the result of the parsing
      • noContent

        public boolean noContent()

        Invoked by the Parser when the frame content length is zero.

        Returns:
        whether the parsing should stop
      • getRequest

        protected int getRequest()
      • getContentLength

        protected int getContentLength()