tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: How to get the AbstractEndpoint from Tomcat with tomcat-embed
Date Wed, 06 Dec 2017 09:41:25 GMT
On 06/12/17 00:17, Jesse Schulman wrote:
> Now that 8.5.24 is released with new support for runtime SNI/SSLHostConfig
> changes (thank you Mark!) I am trying to access the AbstractEndpoint from
> our application to call these 2 new methods:
> 
>     public void addSslHostConfig(SSLHostConfig sslHostConfig, boolean
> replace)
> 
>     public SSLHostConfig removeSslHostConfig(String hostName)
> 
> We have an instance of the Tomcat class from which we can do
> getConnector(), and that Connector can provide us with the
> ProtocolHandler.  With ProtocolHandler we could safely cast to
> AbstractProtocol but from there the getEndpoint method is protected.
> 
> Is there a supported way to access the AbstractEndpoint via public methods
> if I only have the Tomcat/Connector instances available?
> 
> Or maybe this is possible to do with JMX?  If so I would need access to the
> AbstractEndpoint directly so I can pass it my SSLHostConfig objects.

The MBean for an Endpoint has a name that looks like this:

Catalina:type=ThreadPool,name="http-nio-8080"

The name part is the same as that shown in the logs. So if you see this:

06-Dec-2017 09:39:36.986 INFO [main]
org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler
["https-jsse-nio-8443"]

then the MBean name will be:

Catalina:type=ThreadPool,name="https-jsse-nio-8443"

The MBean server should be obtainable with:
Registry.getRegistry(null, null).getMBeanServer();

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message