Package 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 implementProtocolHandler. 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 Description protected booleanajpFlushprotected static StringManagersmThe string manager for this package.-
Fields inherited from class org.apache.coyote.AbstractProtocol
adapter, clientCertProvider, domain, mserver, oname, processorCache, rgOname
-
-
Constructor Summary
Constructors Constructor Description AbstractAjpProtocol(AbstractEndpoint<S,?> endpoint)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddSslHostConfig(SSLHostConfig sslHostConfig)Add a new SSL configuration for a virtual host.voidaddUpgradeProtocol(UpgradeProtocol upgradeProtocol)Add a new protocol for used by HTTP/1.1 upgrade or ALPN.protected ProcessorcreateProcessor()Create and configure a new Processor instance for the current protocol implementation.protected ProcessorcreateUpgradeProcessor(SocketWrapperBase<?> socket, UpgradeToken upgradeToken)SSLHostConfig[]findSslHostConfigs()Find all configured SSL virtual host configurations which will be used by SNI.UpgradeProtocol[]findUpgradeProtocols()Return all configured upgrade protocols.booleangetAjpFlush()java.lang.StringgetAllowedRequestAttributesPattern()protected java.util.regex.PatterngetAllowedRequestAttributesPatternInternal()protected AbstractEndpoint<S,?>getEndpoint()Overridden to make getter accessible to other classes in this package.protected UpgradeProtocolgetNegotiatedProtocol(java.lang.String name)Find a suitable handler for the protocol negotiated at the network layer.intgetPacketSize()protected java.lang.StringgetProtocolName()Obtain the name of the protocol, (Http, Ajp, etc.).protected java.lang.StringgetRequiredSecret()Deprecated.Replaced bygetSecret().protected java.lang.StringgetSecret()booleangetSecretRequired()booleangetTomcatAuthentication()Should authentication be done in the native web server layer, or in the Servlet container ?booleangetTomcatAuthorization()Should authentication be done in the native web server layer and authorization in the Servlet container?protected UpgradeProtocolgetUpgradeProtocol(java.lang.String name)Find a suitable handler for the protocol upgraded name specified.voidsetAjpFlush(boolean ajpFlush)Configure whether to aend an AJP flush packet when flushing.voidsetAllowedRequestAttributesPattern(java.lang.String allowedRequestAttributesPattern)voidsetPacketSize(int packetSize)voidsetRequiredSecret(java.lang.String requiredSecret)Deprecated.Replaced bysetSecret(String).voidsetSecret(java.lang.String secret)Set the secret that must be included with every request.voidsetSecretRequired(boolean secretRequired)voidsetTomcatAuthentication(boolean tomcatAuthentication)voidsetTomcatAuthorization(boolean tomcatAuthorization)voidstart()Start the protocol.-
Methods inherited from class org.apache.coyote.AbstractProtocol
addWaitingProcessor, awaitConnectionsClose, closeServerSocketGraceful, destroy, getAcceptCount, getAcceptorThreadCount, getAcceptorThreadPriority, getAdapter, getAddress, getAsyncTimeout, getBacklog, getClientCertProvider, getConnectionCount, getConnectionLinger, getConnectionTimeout, getDomain, getExecutor, getGlobalRequestProcessorMBeanName, getHandler, getKeepAliveTimeout, getLocalPort, getLog, getMaxConnections, getMaxHeaderCount, getMaxThreads, getMinSpareThreads, getName, getNameIndex, getNamePrefix, getObjectName, getPort, getPortOffset, getPortWithOffset, getProcessorCache, getProperty, getSendReasonPhrase, getSoLinger, getSoTimeout, getTcpNoDelay, getThreadPriority, getWaitingProcessorCount, 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, setPortOffset, setProcessorCache, setProperty, setSendReasonPhrase, setSoLinger, setSoTimeout, setTcpNoDelay, setThreadPriority, stop
-
-
-
-
Field Detail
-
sm
protected static final StringManager sm
The string manager for this package.
-
ajpFlush
protected boolean ajpFlush
-
-
Constructor Detail
-
AbstractAjpProtocol
public AbstractAjpProtocol(AbstractEndpoint<S,?> endpoint)
-
-
Method Detail
-
getProtocolName
protected java.lang.String getProtocolName()
Description copied from class:AbstractProtocolObtain the name of the protocol, (Http, Ajp, etc.). Used with JMX.- Specified by:
getProtocolNamein classAbstractProtocol<S>- Returns:
- the protocol name
-
getEndpoint
protected AbstractEndpoint<S,?> getEndpoint()
Overridden to make getter accessible to other classes in this package.- Overrides:
getEndpointin classAbstractProtocol<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:
getNegotiatedProtocolin classAbstractProtocol<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:
getUpgradeProtocolin classAbstractProtocol<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)
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:
trueif authentication should be performed by Tomcat, otherwisefalse
-
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:
trueif authorization should be performed by Tomcat, otherwisefalse
-
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 bysetSecret(String). Will be removed in Tomcat 11 onwardsSet the required secret that must be included with every request.- Parameters:
requiredSecret- The required secret
-
getRequiredSecret
@Deprecated protected java.lang.String getRequiredSecret()
Deprecated.Replaced bygetSecret(). 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()
-
getAllowedRequestAttributesPatternInternal
protected java.util.regex.Pattern getAllowedRequestAttributesPatternInternal()
-
getPacketSize
public int getPacketSize()
-
setPacketSize
public void setPacketSize(int packetSize)
-
addSslHostConfig
public void addSslHostConfig(SSLHostConfig sslHostConfig)
Description copied from interface:ProtocolHandlerAdd a new SSL configuration for a virtual host.- Parameters:
sslHostConfig- the configuration
-
findSslHostConfigs
public SSLHostConfig[] findSslHostConfigs()
Description copied from interface:ProtocolHandlerFind all configured SSL virtual host configurations which will be used by SNI.- Returns:
- the configurations
-
addUpgradeProtocol
public void addUpgradeProtocol(UpgradeProtocol upgradeProtocol)
Description copied from interface:ProtocolHandlerAdd a new protocol for used by HTTP/1.1 upgrade or ALPN.- Parameters:
upgradeProtocol- the protocol
-
findUpgradeProtocols
public UpgradeProtocol[] findUpgradeProtocols()
Description copied from interface:ProtocolHandlerReturn all configured upgrade protocols.- Returns:
- the protocols
-
createProcessor
protected Processor createProcessor()
Description copied from class:AbstractProtocolCreate and configure a new Processor instance for the current protocol implementation.- Specified by:
createProcessorin classAbstractProtocol<S>- Returns:
- A fully configured Processor instance that is ready to use
-
createUpgradeProcessor
protected Processor createUpgradeProcessor(SocketWrapperBase<?> socket, UpgradeToken upgradeToken)
- Specified by:
createUpgradeProcessorin classAbstractProtocol<S>
-
start
public void start() throws java.lang.ExceptionDescription copied from interface:ProtocolHandlerStart the protocol.- Specified by:
startin interfaceProtocolHandler- Overrides:
startin classAbstractProtocol<S>- Throws:
java.lang.Exception- If the protocol handler fails to start
-
-