InternalAprInputBuffer (Apache Tomcat 7.0.104 API Documentation)

org.apache.coyote.http11

## Class InternalAprInputBuffer

- java.lang.Object
- - org.apache.coyote.http11.AbstractInputBuffer<Long>
  - - org.apache.coyote.http11.InternalAprInputBuffer

- All Implemented Interfaces:
    InputBuffer

      public class InternalAprInputBuffer
      extends AbstractInputBuffer<Long>

  Implementation of InputBuffer which provides HTTP request header parsing as well as transfer decoding.
  Author:
    Remy Maucherat

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `InternalAprInputBuffer.SocketInputBuffer` This class is an input buffer which will read its data from an input stream.

  - ### Field Summary

    - ### Fields inherited from class org.apache.coyote.http11.AbstractInputBuffer

      `activeFilters, buf, chr, end, filterLibrary, headers, httpParser, inputStreamInputBuffer, lastActiveFilter, lastValid, parsingHeader, pos, prevChr, rejectIllegalHeaderName, request, sm, swallowInput`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `InternalAprInputBuffer(Request request, int headerBufferSize, boolean rejectIllegalHeader, HttpParser httpParser)` Alternate constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `doRead(ByteChunk chunk, Request req)` Read some bytes.
    `protected boolean` | `fill()` Fill the internal buffer using data from the underlying input stream.
    `protected boolean` | `fill(boolean block)`
    `protected void` | `init(SocketWrapper<Long> socketWrapper, AbstractEndpoint<Long> endpoint)`
    `boolean` | `parseHeaders()` Parse the HTTP headers.
    `boolean` | `parseRequestLine(boolean useAvailableData)` Read the request line.
    `void` | `recycle()` Recycle the input buffer.

    - ### Methods inherited from class org.apache.coyote.http11.AbstractInputBuffer

      `addActiveFilter, addFilter, available, endRequest, getFilters, nextRequest, parseInvalid, setSwallowInput`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### InternalAprInputBuffer

          public InternalAprInputBuffer(Request request,
                                int headerBufferSize,
                                boolean rejectIllegalHeader,
                                HttpParser httpParser)

      Alternate constructor.

  - ### Method Detail

    - #### recycle

          public void recycle()

      Recycle the input buffer. This should be called when closing the connection.
      Overrides:
        `recycle` in class `AbstractInputBuffer<Long>`

    - #### parseRequestLine

          public boolean parseRequestLine(boolean useAvailableData)
                                   throws IOException

      Read the request line. This function is meant to be used during the HTTP request header parsing. Do NOT attempt to read the request body using it.
      Specified by:
        `parseRequestLine` in class `AbstractInputBuffer<Long>`
      Returns:
        true if data is properly fed; false if no data is available immediately and thread should be freed
      Throws:
        `IOException` - If an exception occurs during the underlying socket read operations, or if the given buffer is not big enough to accommodate the whole line.

    - #### parseHeaders

          public boolean parseHeaders()
                               throws IOException

      Parse the HTTP headers.
      Specified by:
        `parseHeaders` in class `AbstractInputBuffer<Long>`
      Throws:
        `IOException`

    - #### doRead

          public int doRead(ByteChunk chunk,
                   Request req)
                     throws IOException

      Read some bytes.
      Specified by:
        `doRead` in interface `InputBuffer`
      Overrides:
        `doRead` in class `AbstractInputBuffer<Long>`
      Parameters:
        `chunk` - The buffer to read data into.
        `req` - The associated request
      Returns:
        The number of bytes that have been added to the buffer or -1 for end of stream
      Throws:
        `IOException` - If an I/O error occurs reading from the input stream

    - #### init

          protected void init(SocketWrapper<Long> socketWrapper,
                  AbstractEndpoint<Long> endpoint)
                       throws IOException

      Specified by:
        `init` in class `AbstractInputBuffer<Long>`
      Throws:
        `IOException`

    - #### fill

          protected boolean fill(boolean block)
                          throws IOException

      Specified by:
        `fill` in class `AbstractInputBuffer<Long>`
      Throws:
        `IOException`

    - #### fill

          protected boolean fill()
                          throws IOException

      Fill the internal buffer using data from the underlying input stream.
      Returns:
        false if at end of stream
      Throws:
        `IOException`

Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.