org.apache.coyote.ajp

## Class AjpNioProcessor

- java.lang.Object
- - org.apache.coyote.AbstractProcessor<S>
  - - org.apache.coyote.ajp.AbstractAjpProcessor<NioChannel>
    - - org.apache.coyote.ajp.AjpNioProcessor

- All Implemented Interfaces:
    ActionHook, Processor<NioChannel>

      public class AjpNioProcessor
      extends AbstractAjpProcessor<NioChannel>

  Processes AJP requests using NIO.

- - ### 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 NioSelectorPool` | `pool` Selector pool for the associated endpoint.

    - ### 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
    `AjpNioProcessor(int packetSize, NioEndpoint endpoint)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `actionInternal(ActionCode actionCode, java.lang.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<NioChannel> socket)` Process pipelined HTTP requests using the specified input and output streams.
    `protected int` | `read(byte[] buf, int pos, int n, boolean blockFirstRead)` Read at least the specified amount of bytes, and place them in the input buffer.
    `protected int` | `readMessage(AjpMessage message, boolean blockFirstRead)` Read an AJP message.
    `boolean` | `receive()` Receive a chunk of data.
    `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, recycle, 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

    - #### pool

          protected NioSelectorPool pool

      Selector pool for the associated endpoint.

  - ### Constructor Detail

    - #### AjpNioProcessor

          public AjpNioProcessor(int packetSize,
                         NioEndpoint endpoint)

  - ### Method Detail

    - #### getLog

          protected Log getLog()

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

    - #### process

          public AbstractEndpoint.Handler.SocketState process(SocketWrapper<NioChannel> socket)
                                                       throws java.io.IOException

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

    - #### actionInternal

          protected void actionInternal(ActionCode actionCode,
                            java.lang.Object param)

      Send an action to the connector.
      Specified by:
        `actionInternal` in class `AbstractAjpProcessor<NioChannel>`
      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<NioChannel>`

    - #### output

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

      Specified by:
        `output` in class `AbstractAjpProcessor<NioChannel>`
      Throws:
        `java.io.IOException`

    - #### read

          protected int read(byte[] buf,
                 int pos,
                 int n,
                 boolean blockFirstRead)
                      throws java.io.IOException

      Read at least the specified amount of bytes, and place them in the input buffer. Note that if any data is available to read then this method will always block until at least the specified number of bytes have been read.
      Parameters:
        `buf` - Buffer to read data into
        `pos` - Start position
        `n` - The minimum number of bytes to read
        `blockFirstRead` - If there is no data available to read when this method is called, should this call block until data becomes available?
      Returns:
        The number of bytes read
      Throws:
        `java.io.IOException` - If an I/O error occurs during the read

    - #### receive

          public boolean receive()
                          throws java.io.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<NioChannel>`
      Throws:
        `java.io.IOException`

    - #### readMessage

          protected int readMessage(AjpMessage message,
                        boolean blockFirstRead)
                             throws java.io.IOException

      Read an AJP message.
      Parameters:
        `message` - The message to populate
        `blockFirstRead` - If there is no data available to read when this method is called, should this call block until data becomes available?
      Returns:
        The number of bytes read
      Throws:
        `java.io.IOException` - any other failure, including incomplete reads

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