AbstractAjpProtocol (Apache Tomcat 8.5.43 API Documentation)

org.apache.coyote.ajp

## Class AbstractAjpProtocol<S>

- java.lang.Object
- - org.apache.coyote.AbstractProtocol<S>
  - - org.apache.coyote.ajp.AbstractAjpProtocol<S>

- Type Parameters:
    `S` - The type of socket used by the implementation
  All Implemented Interfaces:
    javax.management.MBeanRegistration, ProtocolHandler
  Direct Known Subclasses:
    AjpAprProtocol, AjpNio2Protocol, AjpNioProtocol

      public abstract class AbstractAjpProtocol<S>
      extends AbstractProtocol<S>

  The is the base implementation for the AJP protocol handlers. Implementations typically extend this base class rather than implement `ProtocolHandler`. All of the implementations that ship with Tomcat are implemented this way.

- - ### Nested Class Summary

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

      `AbstractProtocol.AsyncTimeout, AbstractProtocol.ConnectionHandler<S>, AbstractProtocol.RecycledProcessors`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `ajpFlush` Send AJP flush packet when flushing.
    `protected static StringManager` | `sm` The string manager for this package.

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

      `adapter, clientCertProvider, domain, mserver, oname, processorCache, rgOname`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractAjpProtocol(AbstractEndpoint<S> endpoint)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addSslHostConfig(SSLHostConfig sslHostConfig)`
    `void` | `addUpgradeProtocol(UpgradeProtocol upgradeProtocol)`
    `protected Processor` | `createProcessor()` Create and configure a new Processor instance for the current protocol implementation.
    `protected Processor` | `createUpgradeProcessor(SocketWrapperBase<?> socket, UpgradeToken upgradeToken)`
    `SSLHostConfig[]` | `findSslHostConfigs()`
    `UpgradeProtocol[]` | `findUpgradeProtocols()`
    `boolean` | `getAjpFlush()`
    `protected AbstractEndpoint<S>` | `getEndpoint()` Overridden to make getter accessible to other classes in this package.
    `protected UpgradeProtocol` | `getNegotiatedProtocol(java.lang.String name)` Find a suitable handler for the protocol negotiated at the network layer.
    `int` | `getPacketSize()`
    `protected java.lang.String` | `getProtocolName()` Obtain the name of the protocol, (Http, Ajp, etc.).
    `boolean` | `getTomcatAuthentication()`
    `boolean` | `getTomcatAuthorization()`
    `protected UpgradeProtocol` | `getUpgradeProtocol(java.lang.String name)` Find a suitable handler for the protocol upgraded name specified.
    `void` | `setAjpFlush(boolean ajpFlush)`
    `void` | `setPacketSize(int packetSize)`
    `void` | `setRequiredSecret(java.lang.String requiredSecret)`
    `void` | `setTomcatAuthentication(boolean tomcatAuthentication)`
    `void` | `setTomcatAuthorization(boolean tomcatAuthorization)`

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

      `addWaitingProcessor, closeServerSocketGraceful, destroy, getAcceptCount, getAcceptorThreadCount, getAcceptorThreadPriority, getAdapter, getAddress, getAsyncTimeout, getBacklog, getClientCertProvider, getConnectionCount, getConnectionLinger, getConnectionTimeout, getDomain, getExecutor, getHandler, getKeepAliveTimeout, getLocalPort, getLog, getMaxConnections, getMaxHeaderCount, getMaxThreads, getMinSpareThreads, getName, getNameIndex, getNamePrefix, getObjectName, getPort, getProcessorCache, getProperty, getSendReasonPhrase, getSoLinger, getSoTimeout, getTcpNoDelay, getThreadPriority, init, isAprRequired, isSendfileSupported, pause, postDeregister, postRegister, preDeregister, preRegister, removeWaitingProcessor, resume, setAcceptCount, setAcceptorThreadCount, setAcceptorThreadPriority, setAdapter, setAddress, setBacklog, setClientCertProvider, setConnectionLinger, setConnectionTimeout, setExecutor, setHandler, setKeepAliveTimeout, setMaxConnections, setMaxHeaderCount, setMaxThreads, setMinSpareThreads, setPort, setProcessorCache, setProperty, setSendReasonPhrase, setSoLinger, setSoTimeout, setTcpNoDelay, setThreadPriority, start, stop`

    - ### 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.

    - #### 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.

  - ### Constructor Detail

    - #### AbstractAjpProtocol

          public AbstractAjpProtocol(AbstractEndpoint<S> endpoint)

  - ### Method Detail

    - #### getProtocolName

          protected java.lang.String getProtocolName()

      Description copied from class: `AbstractProtocol`
      Obtain the name of the protocol, (Http, Ajp, etc.). Used with JMX.
      Specified by:
        `getProtocolName` in class `AbstractProtocol<S>`
      Returns:
        the protocol name

    - #### getEndpoint

          protected AbstractEndpoint<S> getEndpoint()

      Overridden to make getter accessible to other classes in this package.
      Overrides:
        `getEndpoint` in class `AbstractProtocol<S>`

    - #### getNegotiatedProtocol

          protected UpgradeProtocol getNegotiatedProtocol(java.lang.String name)

      Find a suitable handler for the protocol negotiated at the network layer. AJP does not support protocol negotiation so this always returns null.
      Specified by:
        `getNegotiatedProtocol` in class `AbstractProtocol<S>`
      Parameters:
        `name` - The name of the requested negotiated protocol.
      Returns:
        The instance where `UpgradeProtocol.getAlpnName()` matches the requested protocol

    - #### getUpgradeProtocol

          protected UpgradeProtocol getUpgradeProtocol(java.lang.String name)

      Find a suitable handler for the protocol upgraded name specified. This is used for direct connection protocol selection. AJP does not support protocol upgrade so this always returns null.
      Specified by:
        `getUpgradeProtocol` in class `AbstractProtocol<S>`
      Parameters:
        `name` - The name of the requested negotiated protocol.
      Returns:
        The instance where `UpgradeProtocol.getAlpnName()` matches the requested protocol

    - #### getAjpFlush

          public boolean getAjpFlush()

    - #### setAjpFlush

          public void setAjpFlush(boolean ajpFlush)

    - #### getTomcatAuthentication

          public boolean getTomcatAuthentication()

    - #### setTomcatAuthentication

          public void setTomcatAuthentication(boolean tomcatAuthentication)

    - #### getTomcatAuthorization

          public boolean getTomcatAuthorization()

    - #### setTomcatAuthorization

          public void setTomcatAuthorization(boolean tomcatAuthorization)

    - #### setRequiredSecret

          public void setRequiredSecret(java.lang.String requiredSecret)

    - #### getPacketSize

          public int getPacketSize()

    - #### setPacketSize

          public void setPacketSize(int packetSize)

    - #### addSslHostConfig

          public void addSslHostConfig(SSLHostConfig sslHostConfig)

    - #### findSslHostConfigs

          public SSLHostConfig[] findSslHostConfigs()

    - #### addUpgradeProtocol

          public void addUpgradeProtocol(UpgradeProtocol upgradeProtocol)

    - #### findUpgradeProtocols

          public UpgradeProtocol[] findUpgradeProtocols()

    - #### createProcessor

          protected Processor createProcessor()

      Description copied from class: `AbstractProtocol`
      Create and configure a new Processor instance for the current protocol implementation.
      Specified by:
        `createProcessor` in class `AbstractProtocol<S>`
      Returns:
        A fully configured Processor instance that is ready to use

    - #### createUpgradeProcessor

          protected Processor createUpgradeProcessor(SocketWrapperBase<?> socket,
                                         UpgradeToken upgradeToken)

      Specified by:
        `createUpgradeProcessor` in class `AbstractProtocol<S>`

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