Package org.apache.coyote
Interface ProtocolHandler
- 
- All Known Implementing Classes:
- AbstractAjpProtocol,- AbstractHttp11JsseProtocol,- AbstractHttp11Protocol,- AbstractProtocol,- AjpAprProtocol,- AjpNio2Protocol,- AjpNioProtocol,- Http11AprProtocol,- Http11Nio2Protocol,- Http11NioProtocol
 
 public interface ProtocolHandlerAbstract the protocol implementation, including threading, etc. This is the main interface to be implemented by a coyote protocol. Adapter is the main interface to be implemented by a coyote servlet container.- Author:
- Remy Maucherat, Costin Manolache
- See Also:
- Adapter
 
- 
- 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Default 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.longawaitConnectionsClose(long waitMillis)Wait for the client connections to the server to close gracefully.voidcloseServerSocketGraceful()static ProtocolHandlercreate(java.lang.String protocol, boolean apr)Create a new ProtocolHandler for the given protocol.voiddestroy()Destroy the protocol (optional).SSLHostConfig[]findSslHostConfigs()Find all configured SSL virtual host configurations which will be used by SNI.UpgradeProtocol[]findUpgradeProtocols()Return all configured upgrade protocols.AdaptergetAdapter()Return the adapter associated with the protocol handler.default intgetDesiredBufferSize()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.java.util.concurrent.ExecutorgetExecutor()The executor, provide access to the underlying thread pool.default java.lang.StringgetId()The default behavior is to identify connectors uniquely with address and port.java.util.concurrent.ScheduledExecutorServicegetUtilityExecutor()Get the utility executor that should be used by the protocol handler.voidinit()Initialise the protocol.booleanisAprRequired()Deprecated.This method will be removed in Tomcat 10.1.x onwardsbooleanisSendfileSupported()Does this ProtocolHandler support sendfile?voidpause()Pause the protocol (optional).voidresume()Resume the protocol (optional).voidsetAdapter(Adapter adapter)The adapter, used to call the connector.voidsetExecutor(java.util.concurrent.Executor executor)Set the optional executor that will be used by the connector.voidsetUtilityExecutor(java.util.concurrent.ScheduledExecutorService utilityExecutor)Set the utility executor that should be used by the protocol handler.voidstart()Start the protocol.voidstop()Stop the protocol.
 
- 
- 
- 
Method Detail- 
getAdapterAdapter getAdapter() Return the adapter associated with the protocol handler.- Returns:
- the adapter
 
 - 
setAdaptervoid setAdapter(Adapter adapter) The adapter, used to call the connector.- Parameters:
- adapter- The adapter to associate
 
 - 
getExecutorjava.util.concurrent.Executor getExecutor() The executor, provide access to the underlying thread pool.- Returns:
- The executor used to process requests
 
 - 
setExecutorvoid setExecutor(java.util.concurrent.Executor executor) Set the optional executor that will be used by the connector.- Parameters:
- executor- the executor
 
 - 
getUtilityExecutorjava.util.concurrent.ScheduledExecutorService getUtilityExecutor() Get the utility executor that should be used by the protocol handler.- Returns:
- the executor
 
 - 
setUtilityExecutorvoid setUtilityExecutor(java.util.concurrent.ScheduledExecutorService utilityExecutor) Set the utility executor that should be used by the protocol handler.- Parameters:
- utilityExecutor- the executor
 
 - 
initvoid init() throws java.lang.Exception Initialise the protocol.- Throws:
- java.lang.Exception- If the protocol handler fails to initialise
 
 - 
startvoid start() throws java.lang.ExceptionStart the protocol.- Throws:
- java.lang.Exception- If the protocol handler fails to start
 
 - 
pausevoid pause() throws java.lang.ExceptionPause the protocol (optional).- Throws:
- java.lang.Exception- If the protocol handler fails to pause
 
 - 
resumevoid resume() throws java.lang.ExceptionResume the protocol (optional).- Throws:
- java.lang.Exception- If the protocol handler fails to resume
 
 - 
stopvoid stop() throws java.lang.Exception Stop the protocol.- Throws:
- java.lang.Exception- If the protocol handler fails to stop
 
 - 
destroyvoid destroy() throws java.lang.ExceptionDestroy the protocol (optional).- Throws:
- java.lang.Exception- If the protocol handler fails to destroy
 
 - 
closeServerSocketGracefulvoid closeServerSocketGraceful() 
 - 
awaitConnectionsCloselong awaitConnectionsClose(long waitMillis) Wait for the client connections to the server to close gracefully. The method will return when all of the client connections have closed or the method has been waiting forwaitTimeMillis.- Parameters:
- waitMillis- The maximum time to wait in milliseconds for the client connections to close.
- Returns:
- The wait time, if any remaining when the method returned
 
 - 
isAprRequired@Deprecated boolean isAprRequired() Deprecated.This method will be removed in Tomcat 10.1.x onwardsRequires APR/native library- Returns:
- trueif this Protocol Handler requires the APR/native library, otherwise- false
 
 - 
isSendfileSupportedboolean isSendfileSupported() Does this ProtocolHandler support sendfile?- Returns:
- trueif this Protocol Handler supports sendfile, otherwise- false
 
 - 
addSslHostConfigvoid addSslHostConfig(SSLHostConfig sslHostConfig) Add a new SSL configuration for a virtual host.- Parameters:
- sslHostConfig- the configuration
 
 - 
findSslHostConfigsSSLHostConfig[] findSslHostConfigs() Find all configured SSL virtual host configurations which will be used by SNI.- Returns:
- the configurations
 
 - 
addUpgradeProtocolvoid addUpgradeProtocol(UpgradeProtocol upgradeProtocol) Add a new protocol for used by HTTP/1.1 upgrade or ALPN.- Parameters:
- upgradeProtocol- the protocol
 
 - 
findUpgradeProtocolsUpgradeProtocol[] findUpgradeProtocols() Return all configured upgrade protocols.- Returns:
- the protocols
 
 - 
getDesiredBufferSizedefault int 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:
- the desired buffer size, or -1 if not relevant
 
 - 
getIddefault java.lang.String getId() The default behavior is to identify connectors uniquely with address and port. However, certain connectors are not using that and need some other identifier, which then can be used as a replacement.- Returns:
- the id
 
 - 
createstatic ProtocolHandler create(java.lang.String protocol, boolean apr) throws java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException, java.lang.SecurityException Create a new ProtocolHandler for the given protocol.- Parameters:
- protocol- the protocol
- apr- if- truethe APR protcol handler will be used
- Returns:
- the newly instantiated protocol handler
- Throws:
- java.lang.ClassNotFoundException- Specified protocol was not found
- java.lang.InstantiationException- Specified protocol could not be instantiated
- java.lang.IllegalAccessException- Exception occurred
- java.lang.IllegalArgumentException- Exception occurred
- java.lang.reflect.InvocationTargetException- Exception occurred
- java.lang.NoSuchMethodException- Exception occurred
- java.lang.SecurityException- Exception occurred
 
 
- 
 
-