diff --git a/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/nhttp/config/ClientConnFactoryBuilder.java b/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/nhttp/config/ClientConnFactoryBuilder.java index a3564baaa1..66fde8487c 100644 --- a/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/nhttp/config/ClientConnFactoryBuilder.java +++ b/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/nhttp/config/ClientConnFactoryBuilder.java @@ -370,7 +370,9 @@ private SSLContext createSSLContext(OMElement keyStoreElt, OMElement trustStoreE if (log.isDebugEnabled()) { log.debug(name + " Loading Trust Keystore from : " + location); } - + SslSenderTrustStoreHolder.getInstance().setLocation(location); + SslSenderTrustStoreHolder.getInstance().setPassword(passwordElement.getText()); + SslSenderTrustStoreHolder.getInstance().setType(type); trustStore.load(fis, storePassword.toCharArray()); TrustManagerFactory trustManagerfactory = TrustManagerFactory.getInstance( TrustManagerFactory.getDefaultAlgorithm()); diff --git a/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/nhttp/config/SslSenderTrustStoreHolder.java b/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/nhttp/config/SslSenderTrustStoreHolder.java new file mode 100644 index 0000000000..9bd281c092 --- /dev/null +++ b/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/nhttp/config/SslSenderTrustStoreHolder.java @@ -0,0 +1,51 @@ +package org.apache.synapse.transport.nhttp.config; + +/** + * A SSL Sender TrustStore Holder class to store the client trust store's configurable details. + */ +public class SslSenderTrustStoreHolder { + + private static volatile SslSenderTrustStoreHolder instance; + + private SslSenderTrustStoreHolder() {} + + private String location; + private String password; + private String type; + + public static SslSenderTrustStoreHolder getInstance() { + + if (instance == null) { + synchronized (TrustStoreHolder.class) { + if (instance == null) { + instance = new SslSenderTrustStoreHolder(); + } + } + } + return instance; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getLocation() { + return this.location; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getPassword() { + return this.password; + } + + public void setType(String type) { + this.type = type; + } + + public String getType() { + return this.type; + } +}