AjpAprProcessor (Apache Tomcat 7.0.104 API Documentation)

org.apache.coyote.ajp

## Class AjpAprProcessor

- java.lang.Object
- - org.apache.coyote.AbstractProcessor<S>
  - - org.apache.coyote.ajp.AbstractAjpProcessor<Long>
    - - org.apache.coyote.ajp.AjpAprProcessor

- All Implemented Interfaces:
    ActionHook, Processor<Long>

      public class AjpAprProcessor
      extends AbstractAjpProcessor<Long>

  Processes AJP requests.
  Author:
    Remy Maucherat, Henri Gomez, Dan Milstein, Keith Wannamaker, Kevin Seguin, Costin Manolache, Bill Barker

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.coyote.ajp.AbstractAjpProcessor

      `AbstractAjpProcessor.SocketInputBuffer, AbstractAjpProcessor.SocketOutputBuffer`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ByteBuffer` | `inputBuffer` Direct buffer used for input.
    `protected ByteBuffer` | `outputBuffer` Direct buffer used for output.

    - ### Fields inherited from class org.apache.coyote.ajp.AbstractAjpProcessor

      `ajpFlush, bodyBytes, bodyMessage, bytesWritten, certificates, clientCertProvider, empty, endAndCloseMessageArray, endMessageArray, endOfStream, finished, first, flushMessageArray, getBodyMessageArray, keepAliveTimeout, packetSize, pongMessageArray, replay, requestHeaderMessage, requiredSecret, responseMessage, secret, sm, tmpMB, tomcatAuthentication`

    - ### Fields inherited from class org.apache.coyote.AbstractProcessor

      `adapter, asyncStateMachine, endpoint, hostNameC, request, response, socketWrapper, userDataHelper`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AjpAprProcessor(int packetSize, AprEndpoint endpoint)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `actionInternal(ActionCode actionCode, Object param)` Send an action to the connector.
    `protected Log` | `getLog()`
    `protected void` | `output(byte[] src, int offset, int length)`
    `AbstractEndpoint.Handler.SocketState` | `process(SocketWrapper<Long> socket)` Process pipelined HTTP requests using the specified input and output streams.
    `protected boolean` | `read(int n)` Read at least the specified amount of bytes, and place them in the input buffer.
    `protected boolean` | `readMessage(AjpMessage message, boolean first, boolean useAvailableData)` Read an AJP message.
    `protected boolean` | `readt(int n, boolean useAvailableData)` Read at least the specified amount of bytes, and place them in the input buffer.
    `boolean` | `receive()` Receive a chunk of data.
    `void` | `recycle(boolean socketClosing)` Recycle the processor.
    `protected void` | `resetTimeouts()` Provides a mechanism for those connector implementations (currently only NIO) that need to reset timeouts from Async timeouts to standard HTTP timeouts once async processing completes.

    - ### Methods inherited from class org.apache.coyote.ajp.AbstractAjpProcessor

      `action, asyncDispatch, event, finish, flush, getAjpFlush, getClientCertProvider, getHttpUpgradeHandler, getKeepAliveTimeout, getTomcatAuthentication, getTomcatAuthorization, getUpgradeInbound, isComet, isUpgrade, populateHost, populatePort, prepareRequest, prepareResponse, refillReadBuffer, setAjpFlush, setAllowedRequestAttributesPatternPattern, setClientCertProvider, setKeepAliveTimeout, setRequiredSecret, setSecret, setSslSupport, setTomcatAuthentication, setTomcatAuthorization, upgradeDispatch, upgradeDispatch`

    - ### Methods inherited from class org.apache.coyote.AbstractProcessor

      `asyncPostProcess, errorDispatch, getAdapter, getAsyncStateMachine, getEndpoint, getErrorState, getExecutor, getMaxCookieCount, getRequest, getSocketWrapper, isAsync, parseHost, resetErrorState, setAdapter, setErrorState, setMaxCookieCount, setSocketWrapper`

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

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

- - ### Field Detail

    - #### inputBuffer

          protected ByteBuffer inputBuffer

      Direct buffer used for input.

    - #### outputBuffer

          protected ByteBuffer outputBuffer

      Direct buffer used for output.

  - ### Constructor Detail

    - #### AjpAprProcessor

          public AjpAprProcessor(int packetSize,
                         AprEndpoint endpoint)

  - ### Method Detail

    - #### getLog

          protected Log getLog()

      Specified by:
        `getLog` in class `AbstractProcessor<Long>`

    - #### process

          public AbstractEndpoint.Handler.SocketState process(SocketWrapper<Long> socket)
                                                       throws IOException

      Process pipelined HTTP requests using the specified input and output streams.
      Specified by:
        `process` in interface `Processor<Long>`
      Specified by:
        `process` in class `AbstractProcessor<Long>`
      Throws:
        `IOException` - error during an I/O operation

    - #### actionInternal

          protected void actionInternal(ActionCode actionCode,
                            Object param)

      Send an action to the connector.
      Specified by:
        `actionInternal` in class `AbstractAjpProcessor<Long>`
      Parameters:
        `actionCode` - Type of the action
        `param` - Action parameter

    - #### resetTimeouts

          protected void resetTimeouts()

      Description copied from class: `AbstractAjpProcessor`
      Provides a mechanism for those connector implementations (currently only NIO) that need to reset timeouts from Async timeouts to standard HTTP timeouts once async processing completes.
      Specified by:
        `resetTimeouts` in class `AbstractAjpProcessor<Long>`

    - #### output

          protected void output(byte[] src,
                    int offset,
                    int length)
                         throws IOException

      Specified by:
        `output` in class `AbstractAjpProcessor<Long>`
      Throws:
        `IOException`

    - #### read

          protected boolean read(int n)
                          throws IOException

      Read at least the specified amount of bytes, and place them in the input buffer.
      Parameters:
        `n` - The minimum number of bytes to read before the method returns
      Returns:
        Always `true`
      Throws:
        `IOException` - If an I/O error occurs during the read

    - #### readt

          protected boolean readt(int n,
                      boolean useAvailableData)
                           throws IOException

      Read at least the specified amount of bytes, and place them in the input buffer.
      Parameters:
        `n` - The minimum number of bytes to read
        `useAvailableData` - If `true`, only proceed with the read if there is at least one byte of data available to read in the input buffer
      Returns:
        `true` if the number of bytes requested was read, `false` if no bytes were read
      Throws:
        `IOException` - if an I/O error occurs during the read

    - #### receive

          public boolean receive()
                          throws IOException

      Receive a chunk of data. Called to implement the 'special' packet in ajp13 and to receive the data after we send a GET_BODY packet
      Specified by:
        `receive` in class `AbstractAjpProcessor<Long>`
      Throws:
        `IOException`

    - #### readMessage

          protected boolean readMessage(AjpMessage message,
                            boolean first,
                            boolean useAvailableData)
                                 throws IOException

      Read an AJP message.
      Parameters:
        `message` - The message object to be populated
        `first` - is true if the message is the first in the request, which will cause a short duration blocking read
        `useAvailableData` - If `true` and if `first` is `true`, only proceed with the read if there is at least one byte of data available to read in the input buffer
      Returns:
        true if the message has been read, false if the short read didn't return anything
      Throws:
        `IOException` - any other failure, including incomplete reads

    - #### recycle

          public void recycle(boolean socketClosing)

      Recycle the processor.
      Specified by:
        `recycle` in interface `Processor<Long>`
      Overrides:
        `recycle` in class `AbstractAjpProcessor<Long>`
      Parameters:
        `socketClosing` - Indicates if the socket is about to be closed allowing the processor to perform any additional clean-up that may be required

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