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, AjpNioProtocol, AjpProtocol

      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
    Modifier and Type | Class and Description
    --- | ---
    `protected static class` | `AbstractAjpProtocol.AbstractAjpConnectionHandler<S,P extends AbstractAjpProcessor<S>>`

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

      `AbstractProtocol.AbstractConnectionHandler<S,P extends Processor<S>>, AbstractProtocol.RecycledProcessors<P extends Processor<S>,S>`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `ajpFlush`
    `protected int` | `packetSize` AJP packet size.
    `protected java.lang.String` | `requiredSecret`
    `protected static StringManager` | `sm` The string manager for this package.
    `protected boolean` | `tomcatAuthentication`

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

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

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractAjpProtocol()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `getAjpFlush()`
    `java.lang.String` | `getAllowedRequestAttributesPattern()`
    `protected java.util.regex.Pattern` | `getAllowedRequestAttributesPatternPattern()`
    `int` | `getPacketSize()`
    `protected java.lang.String` | `getProtocolName()` Obtain the name of the protocol, (Http, Ajp, etc.).
    `protected java.lang.String` | `getRequiredSecret()` Deprecated. Replaced by `getSecret()`. Will be removed in Tomcat 11 onwards
    `protected java.lang.String` | `getSecret()`
    `boolean` | `getSecretRequired()`
    `boolean` | `getTomcatAuthentication()` Should authentication be done in the native web server layer, or in the Servlet container ?
    `boolean` | `getTomcatAuthorization()` Should authentication be done in the native web server layer and authorization in the Servlet container?
    `void` | `setAjpFlush(boolean ajpFlush)` Configure whether to aend an AJP flush packet when flushing.
    `void` | `setAllowedRequestAttributesPattern(java.lang.String allowedRequestAttributesPattern)`
    `void` | `setPacketSize(int packetSize)`
    `void` | `setRequiredSecret(java.lang.String requiredSecret)` Deprecated. Replaced by `setSecret(String)`. Will be removed in Tomcat 11 onwards
    `void` | `setSecret(java.lang.String secret)` Set the secret that must be included with every request.
    `void` | `setSecretRequired(boolean secretRequired)`
    `void` | `setTomcatAuthentication(boolean tomcatAuthentication)`
    `void` | `setTomcatAuthorization(boolean tomcatAuthorization)`
    `void` | `start()` Start the protocol.

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

      `destroy, getAdapter, getAddress, getBacklog, getClientCertProvider, getConnectionCount, getConnectionTimeout, getDomain, getExecutor, getHandler, getKeepAliveTimeout, getLocalPort, getLog, getMaxConnections, getMaxCookieCount, getMaxHeaderCount, getMaxThreads, getMinSpareThreads, getName, getNameIndex, getNamePrefix, getObjectName, getPort, getProcessorCache, getProperty, getSoLinger, getSoTimeout, getTcpNoDelay, getThreadPriority, init, isAprRequired, pause, postDeregister, postRegister, preDeregister, preRegister, resume, setAdapter, setAddress, setBacklog, setClientCertProvider, setConnectionTimeout, setExecutor, setKeepAliveTimeout, setMaxConnections, setMaxCookieCount, setMaxHeaderCount, setMaxThreads, setMinSpareThreads, setPort, setProcessorCache, setProperty, setSoLinger, setSoTimeout, setTcpNoDelay, setThreadPriority, 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

    - #### tomcatAuthentication

          protected boolean tomcatAuthentication

    - #### requiredSecret

          protected java.lang.String requiredSecret

    - #### packetSize

          protected int packetSize

      AJP packet size.

  - ### Constructor Detail

    - #### AbstractAjpProtocol

          public AbstractAjpProtocol()

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

    - #### getAjpFlush

          public boolean getAjpFlush()

    - #### setAjpFlush

          public void setAjpFlush(boolean ajpFlush)

      Configure whether to aend an AJP flush packet when flushing. A flush packet is a zero byte AJP13 SEND_BODY_CHUNK packet. mod_jk and mod_proxy_ajp interpret 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.
      Parameters:
        `ajpFlush` - The new flush setting

    - #### getTomcatAuthentication

          public boolean getTomcatAuthentication()

      Should authentication be done in the native web server layer, or in the Servlet container ?
      Returns:
        `true` if authentication should be performed by Tomcat, otherwise `false`

    - #### setTomcatAuthentication

          public void setTomcatAuthentication(boolean tomcatAuthentication)

    - #### getTomcatAuthorization

          public boolean getTomcatAuthorization()

      Should authentication be done in the native web server layer and authorization in the Servlet container?
      Returns:
        `true` if authorization should be performed by Tomcat, otherwise `false`

    - #### setTomcatAuthorization

          public void setTomcatAuthorization(boolean tomcatAuthorization)

    - #### setSecret

          public void setSecret(java.lang.String secret)

      Set the secret that must be included with every request.
      Parameters:
        `secret` - The required secret

    - #### getSecret

          protected java.lang.String getSecret()

    - #### setRequiredSecret

          @Deprecated
          public void setRequiredSecret(java.lang.String requiredSecret)

      Deprecated. Replaced by `setSecret(String)`. Will be removed in Tomcat 11 onwards
      Set the required secret that must be included with every request.
      Parameters:
        `requiredSecret` - The required secret

    - #### getRequiredSecret

          @Deprecated
          protected java.lang.String getRequiredSecret()

      Deprecated. Replaced by `getSecret()`. Will be removed in Tomcat 11 onwards
      Returns:
        The current secret

    - #### setSecretRequired

          public void setSecretRequired(boolean secretRequired)

    - #### getSecretRequired

          public boolean getSecretRequired()

    - #### setAllowedRequestAttributesPattern

          public void setAllowedRequestAttributesPattern(java.lang.String allowedRequestAttributesPattern)

    - #### getAllowedRequestAttributesPattern

          public java.lang.String getAllowedRequestAttributesPattern()

    - #### getAllowedRequestAttributesPatternPattern

          protected java.util.regex.Pattern getAllowedRequestAttributesPatternPattern()

    - #### getPacketSize

          public int getPacketSize()

    - #### setPacketSize

          public void setPacketSize(int packetSize)

    - #### start

          public void start()
                     throws java.lang.Exception

      Description copied from interface: `ProtocolHandler`
      Start the protocol.
      Specified by:
        `start` in interface `ProtocolHandler`
      Overrides:
        `start` in class `AbstractProtocol<S>`
      Throws:
        `java.lang.Exception` - If the protocol handler fails to start

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