Package org.apache.coyote
Interface ProtocolHandler
- All Known Implementing Classes:
AbstractAjpProtocol
,AbstractHttp11JsseProtocol
,AbstractHttp11Protocol
,AbstractProtocol
,AjpAprProtocol
,AjpNio2Protocol
,AjpNioProtocol
,AjpProtocol
,Http11AprProtocol
,Http11Nio2Protocol
,Http11NioProtocol
,Http11Protocol
public interface ProtocolHandler
Abstract 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:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addSslHostConfig
(SSLHostConfig sslHostConfig) Add a new SSL configuration for a virtual host.void
addSslHostConfig
(SSLHostConfig sslHostConfig, boolean replace) Add a new SSL configuration for a virtual host.void
addUpgradeProtocol
(UpgradeProtocol upgradeProtocol) Add a new protocol for used by HTTP/1.1 upgrade or ALPN.long
awaitConnectionsClose
(long waitMillis) Wait for the client connections to the server to close gracefully.void
void
destroy()
Destroy the protocol (optional).Find all configured SSL virtual host configurations which will be used by SNI.Return all configured upgrade protocols.Return the adapter associated with the protocol handler.The executor, provide access to the underlying thread pool.void
init()
Initialise the protocol.boolean
Deprecated.This method will be removed in Tomcat 10.1.x onwardsboolean
Does this ProtocolHandler support sendfile?void
pause()
Pause the protocol (optional).void
resume()
Resume the protocol (optional).void
setAdapter
(Adapter adapter) The adapter, used to call the connector.void
start()
Start the protocol.void
stop()
Stop the protocol.
-
Method Details
-
getAdapter
Adapter getAdapter()Return the adapter associated with the protocol handler.- Returns:
- the adapter
-
setAdapter
The adapter, used to call the connector.- Parameters:
adapter
- The adapter to associate
-
getExecutor
Executor getExecutor()The executor, provide access to the underlying thread pool.- Returns:
- The executor used to process requests
-
init
Initialise the protocol.- Throws:
Exception
- If the protocol handler fails to initialise
-
start
Start the protocol.- Throws:
Exception
- If the protocol handler fails to start
-
pause
Pause the protocol (optional).- Throws:
Exception
- If the protocol handler fails to pause
-
resume
Resume the protocol (optional).- Throws:
Exception
- If the protocol handler fails to resume
-
stop
Stop the protocol.- Throws:
Exception
- If the protocol handler fails to stop
-
destroy
Destroy the protocol (optional).- Throws:
Exception
- If the protocol handler fails to destroy
-
closeServerSocketGraceful
void closeServerSocketGraceful() -
awaitConnectionsClose
long 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.This method will be removed in Tomcat 10.1.x onwardsRequires APR/native library- Returns:
true
if this Protocol Handler requires the APR/native library, otherwisefalse
-
isSendfileSupported
boolean isSendfileSupported()Does this ProtocolHandler support sendfile?- Returns:
true
if this Protocol Handler supports sendfile, otherwisefalse
-
addSslHostConfig
Add a new SSL configuration for a virtual host.- Parameters:
sslHostConfig
- the configuration
-
addSslHostConfig
Add a new SSL configuration for a virtual host.- Parameters:
sslHostConfig
- the configurationreplace
- Iftrue
replacement of an existing configuration is permitted, otherwise any such attempted replacement will trigger an exception- Throws:
IllegalArgumentException
- If the host name is not valid or if a configuration has already been provided for that host and replacement is not allowed
-
findSslHostConfigs
SSLHostConfig[] findSslHostConfigs()Find all configured SSL virtual host configurations which will be used by SNI.- Returns:
- the configurations
-
addUpgradeProtocol
Add a new protocol for used by HTTP/1.1 upgrade or ALPN.- Parameters:
upgradeProtocol
- the protocol
-
findUpgradeProtocols
UpgradeProtocol[] findUpgradeProtocols()Return all configured upgrade protocols.- Returns:
- the protocols
-