1 18 package org.apache.activemq.transport.https; 19 20 import org.apache.activemq.transport.http.HttpTransportServer; 21 import org.mortbay.jetty.security.SslSocketConnector; 22 23 import java.net.URI ; 24 25 public class HttpsTransportServer extends HttpTransportServer { 26 27 private String keyPassword = System.getProperty( "javax.net.ssl.keyPassword" ); 28 private String keyStorePassword = System.getProperty( "javax.net.ssl.keyStorePassword" ); 29 private String keyStore = System.getProperty( "javax.net.ssl.keyStore" ); 30 private String keyStoreType = null; 31 private String secureRandomCertficateAlgorithm = null; 32 private String trustCertificateAlgorithm = null; 33 private String keyCertificateAlgorithm = null; 34 private String protocol = null; 35 36 public HttpsTransportServer( URI uri ) { 37 super( uri ); 38 } 39 40 public void doStart() throws Exception { 41 SslSocketConnector sslConnector = new SslSocketConnector(); 42 sslConnector.setKeystore( keyStore ); 43 sslConnector.setPassword( keyStorePassword ); 44 if ( keyPassword == null ) { 47 sslConnector.setKeyPassword( keyStorePassword ); 48 } 49 if ( keyStoreType != null ) { 50 sslConnector.setKeystoreType( keyStoreType ); 51 } 52 if ( secureRandomCertficateAlgorithm != null ) { 53 sslConnector.setSecureRandomAlgorithm( secureRandomCertficateAlgorithm ); 54 } 55 if ( keyCertificateAlgorithm != null ) { 56 sslConnector.setSslKeyManagerFactoryAlgorithm( keyCertificateAlgorithm ); 57 } 58 if ( trustCertificateAlgorithm != null ) { 59 sslConnector.setSslTrustManagerFactoryAlgorithm( trustCertificateAlgorithm ); 60 } 61 if ( protocol != null ) { 62 sslConnector.setProtocol( protocol ); 63 } 64 65 setConnector(sslConnector); 66 67 super.doStart(); 68 } 69 70 73 public String getKeyStore() { 74 return keyStore; 75 } 76 77 public void setKeyStore( String keyStore ) { 78 this.keyStore = keyStore; 79 } 80 81 public String getKeyPassword() { 82 return keyPassword; 83 } 84 85 public void setKeyPassword( String keyPassword ) { 86 this.keyPassword = keyPassword; 87 } 88 89 public String getKeyStoreType() { 90 return keyStoreType; 91 } 92 93 public void setKeyStoreType( String keyStoreType ) { 94 this.keyStoreType = keyStoreType; 95 } 96 97 public String getKeyStorePassword() { 98 return keyStorePassword; 99 } 100 101 public void setKeyStorePassword( String keyStorePassword ) { 102 this.keyStorePassword = keyStorePassword; 103 } 104 105 public String getProtocol() { 106 return protocol; 107 } 108 109 public void setProtocol( String protocol ) { 110 this.protocol = protocol; 111 } 112 113 public String getSecureRandomCertficateAlgorithm() { 114 return secureRandomCertficateAlgorithm; 115 } 116 117 public void setSecureRandomCertficateAlgorithm(String secureRandomCertficateAlgorithm) { 118 this.secureRandomCertficateAlgorithm = secureRandomCertficateAlgorithm; 119 } 120 121 public String getKeyCertificateAlgorithm() { 122 return keyCertificateAlgorithm; 123 } 124 125 public void setKeyCertificateAlgorithm(String keyCertificateAlgorithm) { 126 this.keyCertificateAlgorithm = keyCertificateAlgorithm; 127 } 128 129 public String getTrustCertificateAlgorithm() { 130 return trustCertificateAlgorithm; 131 } 132 133 public void setTrustCertificateAlgorithm(String trustCertificateAlgorithm) { 134 this.trustCertificateAlgorithm = trustCertificateAlgorithm; 135 } 136 137 } 138 | Popular Tags |