Top Description Fields Constructors Methods
org.apache.coyote.ajp

public abstract Class AbstractAjpProtocol<S>

extends AbstractProtocol<S>
Class Inheritance
Known Direct Subclasses
org.apache.coyote.ajp.AjpNio2Protocol, org.apache.coyote.ajp.AjpNioProtocol
Type Parameters
<S>
The type of socket used by the implementation
Imports
java.net.InetAddress, java.util.regex.Pattern, org.apache.coyote.AbstractProtocol, .Processor, .UpgradeProtocol, .UpgradeToken, org.apache.tomcat.util.net.AbstractEndpoint, .SSLHostConfig, .SocketWrapperBase, org.apache.tomcat.util.res.StringManager

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

Field Summary

Modifier and TypeField and Description
private boolean
private Pattern
private int
packetSize

AJP packet size.

private String
private boolean
protected static final StringManager
sm

Hides org.apache.coyote.AbstractProtocol.sm.

The string manager for this package.
private boolean
private boolean
Inherited from org.apache.coyote.AbstractProtocol:
adapterdomainmserveronameprocessorCachergOname

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addSslHostConfig(SSLHostConfig
the configuration
sslHostConfig
)

Implements org.apache.coyote.ProtocolHandler.addSslHostConfig.

Add a new SSL configuration for a virtual host.

public void
addSslHostConfig(SSLHostConfig
the configuration
sslHostConfig
,
boolean
If true replacement of an existing configuration is permitted, otherwise any such attempted replacement will trigger an exception
replace
)

Implements org.apache.coyote.ProtocolHandler.addSslHostConfig.

Add a new SSL configuration for a virtual host.

public void
addUpgradeProtocol(UpgradeProtocol
the protocol
upgradeProtocol
)

Implements org.apache.coyote.ProtocolHandler.addUpgradeProtocol.

Add a new protocol for used by HTTP/1.1 upgrade or ALPN.

protected Processor
createProcessor()

Implements abstract org.apache.coyote.AbstractProtocol.createProcessor.

Create and configure a new Processor instance for the current protocol implementation.

protected Processor
public SSLHostConfig[]
findSslHostConfigs()

Implements org.apache.coyote.ProtocolHandler.findSslHostConfigs.

Find all configured SSL virtual host configurations which will be used by SNI.

public UpgradeProtocol[]
findUpgradeProtocols()

Implements org.apache.coyote.ProtocolHandler.findUpgradeProtocols.

Return all configured upgrade protocols.

public boolean
public String
protected Pattern
public int
getDesiredBufferSize()

Overrides default org.apache.coyote.ProtocolHandler.getDesiredBufferSize.

Some protocols, like AJP, have a packet length that shouldn't be exceeded, and this can be used to adjust the buffering used by the application layer.

protected AbstractEndpoint<S, ?>
getEndpoint()

Overrides org.apache.coyote.AbstractProtocol.getEndpoint.

Overridden to make getter accessible to other classes in this package.

protected UpgradeProtocol
getNegotiatedProtocol(String
The name of the requested negotiated protocol.
name
)

Implements abstract org.apache.coyote.AbstractProtocol.getNegotiatedProtocol.

Find a suitable handler for the protocol negotiated at the network layer.

public int
protected String
getProtocolName()

Implements abstract org.apache.coyote.AbstractProtocol.getProtocolName.

Obtain the name of the protocol, (Http, Ajp, etc.).

protected String

Returns:

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

protected String
public boolean
public boolean

Returns:

true if authentication should be performed by Tomcat, otherwise false
getTomcatAuthentication
()

Should authentication be done in the native web server layer, or in the Servlet container ?

public boolean

Returns:

true if authorization should be performed by Tomcat, otherwise false
getTomcatAuthorization
()

Should authentication be done in the native web server layer and authorization in the Servlet container?

protected UpgradeProtocol
getUpgradeProtocol(String
The name of the requested negotiated protocol.
name
)

Implements abstract org.apache.coyote.AbstractProtocol.getUpgradeProtocol.

Find a suitable handler for the protocol upgraded name specified.

public void
setAjpFlush(boolean
The new flush setting
ajpFlush
)

Configure whether to aend an AJP flush packet when flushing.

public void
setAllowedRequestAttributesPattern(String allowedRequestAttributesPattern)

public void
setPacketSize(int packetSize)

public void
setRequiredSecret(String
The required secret
requiredSecret
)
Deprecated Replaced by setSecret(String). Will be removed in Tomcat 11 onwards

Set the required secret that must be included with every request.

public void
setSecret(String
The required secret
secret
)

Set the secret that must be included with every request.

public void
setSecretRequired(boolean secretRequired)

public void
setTomcatAuthentication(boolean tomcatAuthentication)

public void
setTomcatAuthorization(boolean tomcatAuthorization)

public void
Inherited from org.apache.coyote.AbstractProtocol:
addWaitingProcessorawaitConnectionsClosecloseServerSocketGracefuldestroygetAcceptCountgetAcceptorThreadPrioritygetAdaptergetAddressgetClientCertProvidergetConnectionCountgetConnectionLingergetConnectionTimeoutgetDomaingetExecutorgetGlobalRequestProcessorMBeanNamegetHandlergetIdgetKeepAliveTimeoutgetLocalPortgetLoggetMaxConnectionsgetMaxHeaderCountgetMaxThreadsgetMinSpareThreadsgetNamegetNameIndexgetNamePrefixgetObjectNamegetPortgetPortOffsetgetPortWithOffsetgetProcessorCachegetPropertygetTcpNoDelaygetThreadPrioritygetUtilityExecutorgetWaitingProcessorCountinitisPausedisSendfileSupportedpausepostDeregisterpostRegisterpreDeregisterpreRegisterremoveWaitingProcessorresumesetAcceptCountsetAcceptorThreadPrioritysetAdaptersetAddresssetClientCertProvidersetConnectionLingersetConnectionTimeoutsetExecutorsetHandlersetKeepAliveTimeoutsetMaxConnectionssetMaxHeaderCountsetMaxThreadssetMinSpareThreadssetPortsetPortOffsetsetProcessorCachesetPropertysetTcpNoDelaysetThreadPrioritysetUtilityExecutorstartAsyncTimeoutstopstopAsyncTimeout

Field Detail

ajpFlushback to summary
private boolean ajpFlush
allowedRequestAttributesPatternback to summary
private Pattern allowedRequestAttributesPattern
packetSizeback to summary
private int packetSize

AJP packet size.

secretback to summary
private String secret
secretRequiredback to summary
private boolean secretRequired
smback to summary
protected static final StringManager sm

Hides org.apache.coyote.AbstractProtocol.sm.

The string manager for this package.

tomcatAuthenticationback to summary
private boolean tomcatAuthentication
tomcatAuthorizationback to summary
private boolean tomcatAuthorization

Constructor Detail

AbstractAjpProtocolback to summary
public AbstractAjpProtocol(AbstractEndpoint<S, ?> endpoint)

Method Detail

addSslHostConfigback to summary
public void addSslHostConfig(SSLHostConfig sslHostConfig)

Implements org.apache.coyote.ProtocolHandler.addSslHostConfig.

Doc from org.apache.coyote.ProtocolHandler.addSslHostConfig.

Add a new SSL configuration for a virtual host.

Parameters
sslHostConfig:SSLHostConfig

the configuration

Annotations
@Override
addSslHostConfigback to summary
public void addSslHostConfig(SSLHostConfig sslHostConfig, boolean replace)

Implements org.apache.coyote.ProtocolHandler.addSslHostConfig.

Doc from org.apache.coyote.ProtocolHandler.addSslHostConfig.

Add a new SSL configuration for a virtual host.

Parameters
sslHostConfig:SSLHostConfig

the configuration

replace:boolean

If true replacement of an existing configuration is permitted, otherwise any such attempted replacement will trigger an exception

Annotations
@Override
addUpgradeProtocolback to summary
public void addUpgradeProtocol(UpgradeProtocol upgradeProtocol)

Implements org.apache.coyote.ProtocolHandler.addUpgradeProtocol.

Doc from org.apache.coyote.ProtocolHandler.addUpgradeProtocol.

Add a new protocol for used by HTTP/1.1 upgrade or ALPN.

Parameters
upgradeProtocol:UpgradeProtocol

the protocol

Annotations
@Override
createProcessorback to summary
protected Processor createProcessor()

Implements abstract org.apache.coyote.AbstractProtocol.createProcessor.

Doc from org.apache.coyote.AbstractProtocol.createProcessor.

Create and configure a new Processor instance for the current protocol implementation.

Returns:Processor

A fully configured Processor instance that is ready to use

Annotations
@Override
createUpgradeProcessorback to summary
protected Processor createUpgradeProcessor(SocketWrapperBase<?> socket, UpgradeToken upgradeToken)

Implements abstract org.apache.coyote.AbstractProtocol.createUpgradeProcessor.

Annotations
@Override
findSslHostConfigsback to summary
public SSLHostConfig[] findSslHostConfigs()

Implements org.apache.coyote.ProtocolHandler.findSslHostConfigs.

Doc from org.apache.coyote.ProtocolHandler.findSslHostConfigs.

Find all configured SSL virtual host configurations which will be used by SNI.

Returns:SSLHostConfig[]

the configurations

Annotations
@Override
findUpgradeProtocolsback to summary
public UpgradeProtocol[] findUpgradeProtocols()

Implements org.apache.coyote.ProtocolHandler.findUpgradeProtocols.

Doc from org.apache.coyote.ProtocolHandler.findUpgradeProtocols.

Return all configured upgrade protocols.

Returns:UpgradeProtocol[]

the protocols

Annotations
@Override
getAjpFlushback to summary
public boolean getAjpFlush()
getAllowedRequestAttributesPatternback to summary
public String getAllowedRequestAttributesPattern()
getAllowedRequestAttributesPatternInternalback to summary
protected Pattern getAllowedRequestAttributesPatternInternal()
getDesiredBufferSizeback to summary
public int getDesiredBufferSize()

Overrides default org.apache.coyote.ProtocolHandler.getDesiredBufferSize.

Doc from org.apache.coyote.ProtocolHandler.getDesiredBufferSize.

Some protocols, like AJP, have a packet length that shouldn't be exceeded, and this can be used to adjust the buffering used by the application layer.

Returns:int

the desired buffer size, or -1 if not relevant

Annotations
@Override
getEndpointback to summary
protected AbstractEndpoint<S, ?> getEndpoint()

Overrides org.apache.coyote.AbstractProtocol.getEndpoint.

Overridden to make getter accessible to other classes in this package.

Annotations
@Override
getNegotiatedProtocolback to summary
protected UpgradeProtocol getNegotiatedProtocol(String name)

Implements abstract org.apache.coyote.AbstractProtocol.getNegotiatedProtocol.

Doc from org.apache.coyote.AbstractProtocol.getNegotiatedProtocol.

Find a suitable handler for the protocol negotiated at the network layer. AJP does not support protocol negotiation so this always returns null.

Parameters
name:String

The name of the requested negotiated protocol.

Returns:UpgradeProtocol

The instance where UpgradeProtocol#getAlpnName() matches the requested protocol

Annotations
@Override
getPacketSizeback to summary
public int getPacketSize()
getProtocolNameback to summary
protected String getProtocolName()

Implements abstract org.apache.coyote.AbstractProtocol.getProtocolName.

Doc from org.apache.coyote.AbstractProtocol.getProtocolName.

Obtain the name of the protocol, (Http, Ajp, etc.). Used with JMX.

Returns:String

the protocol name

Annotations
@Override
getRequiredSecretback to summary
protected String getRequiredSecret()

Deprecated

Replaced by getSecret(). Will be removed in Tomcat 11 onwards

Returns:String

The current secret

Annotations
@Deprecated
getSecretback to summary
protected String getSecret()
getSecretRequiredback to summary
public boolean getSecretRequired()
getTomcatAuthenticationback to summary
public boolean getTomcatAuthentication()

Should authentication be done in the native web server layer, or in the Servlet container ?

Returns:boolean

true if authentication should be performed by Tomcat, otherwise false

getTomcatAuthorizationback to summary
public boolean getTomcatAuthorization()

Should authentication be done in the native web server layer and authorization in the Servlet container?

Returns:boolean

true if authorization should be performed by Tomcat, otherwise false

getUpgradeProtocolback to summary
protected UpgradeProtocol getUpgradeProtocol(String name)

Implements abstract org.apache.coyote.AbstractProtocol.getUpgradeProtocol.

Doc from org.apache.coyote.AbstractProtocol.getUpgradeProtocol.

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.

Parameters
name:String

The name of the requested negotiated protocol.

Returns:UpgradeProtocol

The instance where UpgradeProtocol#getAlpnName() matches the requested protocol

Annotations
@Override
setAjpFlushback to summary
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:boolean

The new flush setting

setAllowedRequestAttributesPatternback to summary
public void setAllowedRequestAttributesPattern(String allowedRequestAttributesPattern)
setPacketSizeback to summary
public void setPacketSize(int packetSize)
setRequiredSecretback to summary
public void setRequiredSecret(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:String

The required secret

Annotations
@Deprecated
setSecretback to summary
public void setSecret(String secret)

Set the secret that must be included with every request.

Parameters
secret:String

The required secret

setSecretRequiredback to summary
public void setSecretRequired(boolean secretRequired)
setTomcatAuthenticationback to summary
public void setTomcatAuthentication(boolean tomcatAuthentication)
setTomcatAuthorizationback to summary
public void setTomcatAuthorization(boolean tomcatAuthorization)
startback to summary
public void start() throws Exception

Overrides org.apache.coyote.AbstractProtocol.start.

Implements org.apache.coyote.ProtocolHandler.start.

Doc from org.apache.coyote.ProtocolHandler.start.

Start the protocol.

Annotations
@Override
Exceptions
Exception:
If the protocol handler fails to start