You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Steffen Heil (Mailinglisten)" <li...@steffen-heil.de> on 2015/05/26 18:31:20 UTC

How to configure a TrustManager in code?

Hi


I am creating several components for my web application in java code instead of the xml files.
For this I am using a privileged servlet that (besides other things) creates a Connector and a Realm.
That's working fine.

As I can do  context.setRealm(...) I can use a Realm that is loaded in my code (thus using my classloader).

I can also set the class name for the TrustManager using the following code when creating the Connector instance:
  nioConnector.setAttribute( "trustManagerClassName", "mypackage.AcceptingTrustManager" );

While this works, it uses the tomcat classloader instead of my own.
So I have to public a single class of my application in a jar file inside tomcats lib folder.


Is there another way to set the TrustManager - preferably in a way that does not require changes in the classpath for tomcat?


Regards,
  Steffen