I am using embedded Tomcat and using SSLHostConfig to add SNI certificates when I create the connector. It works wonderfully.
I am also able to add certificates without restarting Tomcat using something like this:
SSLHostConfig sslHostConfig = new SSLHostConfig();
sslHostConfig2.setHostName(host);
sslHostConfig2.setCertificateFile(path);
connector.addSslHostConfig(sslHostConfig);
This also works perfectly.
Also, without restarting Tomcat, I can get a list of all the existing SSLHostConfig instances using this:
SSLHostConfig[] sslHostConfigs = connector.findSslHostConfigs();
However, I couldn’t figure out how to update or delete an existing SSLHostConfig instance. Setting it to null in the array doesn’t work. Also, replacing it in the array with a new SSLHostConfig instance doesn’t work either.
Is there a way to delete an SSLHostConfig instance without restarting Tomcat?
Through the NioEndpoint object there is a method to removeSslHostConfig. however there is not way to get NioEndpoint from Connector or Protocol Handler as endpoint is protected field.