org.apache.coyote.ajp

## Class AbstractAjpProcessor<S>

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

- All Implemented Interfaces:
    ActionHook, Processor<S>
  Direct Known Subclasses:
    AjpAprProcessor, AjpNioProcessor, AjpProcessor

      public abstract class AbstractAjpProcessor<S>
      extends AbstractProcessor<S>

  Base class for AJP Processor implementations.

- - ### Nested Class Summary

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

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `ajpFlush` Send AJP flush packet when flushing.
    `protected MessageBytes` | `bodyBytes` Body message.
    `protected AjpMessage` | `bodyMessage` Body message.
    `protected long` | `bytesWritten` Bytes written to client for the current request.
    `protected MessageBytes` | `certificates` Byte chunk for certs.
    `protected String` | `clientCertProvider` When client certificate information is presented in a form other than instances of `X509Certificate` it needs to be converted before it can be used and this property controls which JSSE provider is used to perform the conversion.
    `protected boolean` | `empty` Body empty flag.
    `protected static byte[]` | `endAndCloseMessageArray`
    `protected static byte[]` | `endMessageArray` End message array.
    `protected boolean` | `endOfStream` End of stream flag.
    `protected boolean` | `finished` Finished response.
    `protected boolean` | `first` First read.
    `protected static byte[]` | `flushMessageArray` Flush message array.
    `protected byte[]` | `getBodyMessageArray` GetBody message array.
    `protected char[]` | `hostNameC` Host name (used to avoid useless B2C conversion on the host name).
    `protected int` | `keepAliveTimeout` The number of milliseconds Tomcat will wait for a subsequent request before closing the connection.
    `protected int` | `packetSize` AJP packet size.
    `protected static byte[]` | `pongMessageArray` Pong message array.
    `protected boolean` | `replay` Replay read.
    `protected AjpMessage` | `requestHeaderMessage` Header message.
    `protected String` | `requiredSecret` Required secret.
    `protected AjpMessage` | `responseMessage` Message used for response composition.
    `protected static StringManager` | `sm` The string manager for this package.
    `protected MessageBytes` | `tmpMB` Temp message bytes used for processing.
    `protected boolean` | `tomcatAuthentication` Use Tomcat authentication ?

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

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

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractAjpProcessor(int packetSize, AbstractEndpoint<S> endpoint)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `action(ActionCode actionCode, Object param)` Send an action to the connector.
    `protected abstract void` | `actionInternal(ActionCode actionCode, Object param)`
    `AbstractEndpoint.Handler.SocketState` | `asyncDispatch(SocketStatus status)` Process in-progress Servlet 3.0 Async requests.
    `AbstractEndpoint.Handler.SocketState` | `event(SocketStatus status)` Process in-progress Comet requests.
    `protected void` | `finish()` Finish AJP response.
    `protected void` | `flush(boolean explicit)` Callback to write data from the buffer.
    `boolean` | `getAjpFlush()`
    `String` | `getClientCertProvider()`
    `HttpUpgradeHandler` | `getHttpUpgradeHandler()`
    `int` | `getKeepAliveTimeout()`
    `boolean` | `getTomcatAuthentication()`
    `boolean` | `getTomcatAuthorization()`
    `UpgradeInbound` | `getUpgradeInbound()` Deprecated. Will be removed in Tomcat 8.0.x.
    `boolean` | `isComet()`
    `boolean` | `isUpgrade()`
    `protected abstract void` | `output(byte[] src, int offset, int length)`
    `protected void` | `parseHost(MessageBytes valueMB)` Parse host.
    `protected void` | `prepareRequest()` After reading the request headers, we have to setup the request filters.
    `protected void` | `prepareResponse()` When committing the response, we have to validate the set of headers, as well as setup the response filters.
    `protected abstract boolean` | `receive()`
    `void` | `recycle(boolean socketClosing)` Recycle the processor, ready for the next request which may be on the same connection or a different connection.
    `protected boolean` | `refillReadBuffer()` Get more request body data from the web server and store it in the internal buffer.
    `protected abstract 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.
    `void` | `setAjpFlush(boolean ajpFlush)`
    `void` | `setClientCertProvider(String s)`
    `void` | `setKeepAliveTimeout(int timeout)`
    `void` | `setRequiredSecret(String requiredSecret)`
    `void` | `setSslSupport(SSLSupport sslSupport)`
    `void` | `setTomcatAuthentication(boolean tomcatAuthentication)`
    `void` | `setTomcatAuthorization(boolean tomcatAuthorization)`
    `AbstractEndpoint.Handler.SocketState` | `upgradeDispatch()` Processes data received on a connection that has been through an HTTP upgrade.
    `AbstractEndpoint.Handler.SocketState` | `upgradeDispatch(SocketStatus status)`

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

      `asyncPostProcess, errorDispatch, getAdapter, getEndpoint, getErrorState, getExecutor, getLog, getRequest, getSocketWrapper, isAsync, process, resetErrorState, setAdapter, setErrorState, setSocketWrapper`

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

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

- - ### Field Detail

    - #### sm

          protected static final StringManager sm

      The string manager for this package.

    - #### endMessageArray

          protected static final byte[] endMessageArray

      End message array.

    - #### endAndCloseMessageArray

          protected static final byte[] endAndCloseMessageArray

    - #### flushMessageArray

          protected static final byte[] flushMessageArray

      Flush message array.

    - #### pongMessageArray

          protected static final byte[] pongMessageArray

      Pong message array.

    - #### getBodyMessageArray

          protected final byte[] getBodyMessageArray

      GetBody message array. Not static like the other message arrays since the message varies with packetSize and that can vary per connector.

    - #### packetSize

          protected int packetSize

      AJP packet size.

    - #### requestHeaderMessage

          protected AjpMessage requestHeaderMessage

      Header message. Note that this header is merely the one used during the processing of the first message of a "request", so it might not be a request header. It will stay unchanged during the processing of the whole request.

    - #### responseMessage

          protected AjpMessage responseMessage

      Message used for response composition.

    - #### bodyMessage

          protected AjpMessage bodyMessage

      Body message.

    - #### bodyBytes

          protected MessageBytes bodyBytes

      Body message.

    - #### hostNameC

          protected char[] hostNameC

      Host name (used to avoid useless B2C conversion on the host name).

    - #### tmpMB

          protected MessageBytes tmpMB

      Temp message bytes used for processing.

    - #### certificates

          protected MessageBytes certificates

      Byte chunk for certs.

    - #### endOfStream

          protected boolean endOfStream

      End of stream flag.

    - #### empty

          protected boolean empty

      Body empty flag.

    - #### first

          protected boolean first

      First read.

    - #### replay

          protected boolean replay

      Replay read.

    - #### finished

          protected boolean finished

      Finished response.

    - #### bytesWritten

          protected long bytesWritten

      Bytes written to client for the current request.

    - #### ajpFlush

          protected boolean ajpFlush

      Send AJP flush packet when flushing. An flush packet is a zero byte AJP13 SEND_BODY_CHUNK packet. mod_jk and mod_proxy_ajp interprete this as a request to flush data to the client. AJP always does flush at the and of the response, so if it is not important, that the packets get streamed up to the client, do not use extra flush packets. For compatibility and to stay on the safe side, flush packets are enabled by default.

    - #### keepAliveTimeout

          protected int keepAliveTimeout

      The number of milliseconds Tomcat will wait for a subsequent request before closing the connection. The default is the same as for Apache HTTP Server (15 000 milliseconds).

    - #### tomcatAuthentication

          protected boolean tomcatAuthentication

      Use Tomcat authentication ?

    - #### requiredSecret

          protected String requiredSecret

      Required secret.

    - #### clientCertProvider

          protected String clientCertProvider

      When client certificate information is presented in a form other than instances of `X509Certificate` it needs to be converted before it can be used and this property controls which JSSE provider is used to perform the conversion. For example it is used with the AJP connectors, the HTTP APR connector and with the `SSLValve`. If not specified, the default provider will be used.

  - ### Constructor Detail

    - #### AbstractAjpProcessor

          public AbstractAjpProcessor(int packetSize,
                              AbstractEndpoint<S> endpoint)

  - ### Method Detail

    - #### getAjpFlush

          public boolean getAjpFlush()

    - #### setAjpFlush

          public void setAjpFlush(boolean ajpFlush)

    - #### getKeepAliveTimeout

          public int getKeepAliveTimeout()

    - #### setKeepAliveTimeout

          public void setKeepAliveTimeout(int timeout)

    - #### getTomcatAuthentication

          public boolean getTomcatAuthentication()

    - #### setTomcatAuthentication

          public void setTomcatAuthentication(boolean tomcatAuthentication)

    - #### getTomcatAuthorization

          public boolean getTomcatAuthorization()

    - #### setTomcatAuthorization

          public void setTomcatAuthorization(boolean tomcatAuthorization)

    - #### setRequiredSecret

          public void setRequiredSecret(String requiredSecret)

    - #### getClientCertProvider

          public String getClientCertProvider()

    - #### setClientCertProvider

          public void setClientCertProvider(String s)

    - #### action

          public final void action(ActionCode actionCode,
                    Object param)

      Send an action to the connector.
      Parameters:
        `actionCode` - Type of the action
        `param` - Action parameter

    - #### asyncDispatch

          public AbstractEndpoint.Handler.SocketState asyncDispatch(SocketStatus status)

      Description copied from class: `AbstractProcessor`
      Process in-progress Servlet 3.0 Async requests. These will start as HTTP requests.
      Specified by:
        `asyncDispatch` in interface `Processor<S>`
      Specified by:
        `asyncDispatch` in class `AbstractProcessor<S>`

    - #### setSslSupport

          public void setSslSupport(SSLSupport sslSupport)

    - #### event

          public AbstractEndpoint.Handler.SocketState event(SocketStatus status)
                                                     throws IOException

      Description copied from class: `AbstractProcessor`
      Process in-progress Comet requests. These will start as HTTP requests.
      Specified by:
        `event` in interface `Processor<S>`
      Specified by:
        `event` in class `AbstractProcessor<S>`
      Throws:
        `IOException`

    - #### upgradeDispatch

          public AbstractEndpoint.Handler.SocketState upgradeDispatch()
                                                               throws IOException

      Description copied from class: `AbstractProcessor`
      Processes data received on a connection that has been through an HTTP upgrade.
      Specified by:
        `upgradeDispatch` in interface `Processor<S>`
      Specified by:
        `upgradeDispatch` in class `AbstractProcessor<S>`
      Throws:
        `IOException`

    - #### getUpgradeInbound

          @Deprecated
          public UpgradeInbound getUpgradeInbound()

      Deprecated. Will be removed in Tomcat 8.0.x.
      Specified by:
        `getUpgradeInbound` in interface `Processor<S>`
      Specified by:
        `getUpgradeInbound` in class `AbstractProcessor<S>`

    - #### upgradeDispatch

          public AbstractEndpoint.Handler.SocketState upgradeDispatch(SocketStatus status)
                                                               throws IOException

      Throws:
        `IOException`

    - #### getHttpUpgradeHandler

          public HttpUpgradeHandler getHttpUpgradeHandler()

    - #### recycle

          public void recycle(boolean socketClosing)

      Recycle the processor, ready for the next request which may be on the same connection or a different connection.
      Parameters:
        `socketClosing` - Indicates if the socket is about to be closed allowing the processor to perform any additional clean-up that may be required

    - #### actionInternal

          protected abstract void actionInternal(ActionCode actionCode,
                            Object param)

    - #### resetTimeouts

          protected abstract 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.

    - #### output

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

      Throws:
        `IOException`

    - #### receive

          protected abstract boolean receive()
                                      throws IOException

      Throws:
        `IOException`

    - #### isComet

          public final boolean isComet()

      Specified by:
        `isComet` in interface `Processor<S>`
      Specified by:
        `isComet` in class `AbstractProcessor<S>`

    - #### isUpgrade

          public final boolean isUpgrade()

      Specified by:
        `isUpgrade` in interface `Processor<S>`
      Specified by:
        `isUpgrade` in class `AbstractProcessor<S>`

    - #### refillReadBuffer

          protected boolean refillReadBuffer()
                                      throws IOException

      Get more request body data from the web server and store it in the internal buffer.
      Returns:
        true if there is more data, false if not.
      Throws:
        `IOException`

    - #### prepareRequest

          protected void prepareRequest()

      After reading the request headers, we have to setup the request filters.

    - #### parseHost

          protected void parseHost(MessageBytes valueMB)

      Parse host.

    - #### prepareResponse

          protected void prepareResponse()
                                  throws IOException

      When committing the response, we have to validate the set of headers, as well as setup the response filters.
      Throws:
        `IOException`

    - #### flush

          protected void flush(boolean explicit)
                        throws IOException

      Callback to write data from the buffer.
      Throws:
        `IOException`

    - #### finish

          protected void finish()
                         throws IOException

      Finish AJP response.
      Throws:
        `IOException`

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