Source code: org/activemq/transport/https/HttpsTransportConnector.java
1 /*
2 * Created on 12-Aug-2005
3 */
4 package org.activemq.transport.https;
5
6 import java.net.URI;
7
8 import javax.jms.JMSException;
9
10 import org.activemq.transport.http.HttpTransportConnector;
11 import org.apache.commons.logging.Log;
12 import org.apache.commons.logging.LogFactory;
13 import org.mortbay.http.SslListener;
14
15 public class HttpsTransportConnector extends HttpTransportConnector {
16
17 private static final Log log = LogFactory.getLog( HttpsTransportConnector.class );
18
19 private String keyPassword = System.getProperty( "javax.net.ssl.keyPassword" );
20 private String keyStorePassword = System.getProperty( "javax.net.ssl.keyStorePassword" );
21 private String keyStore = System.getProperty( "javax.net.ssl.keyStore" );
22 private String keyStoreType = null;
23 private String certificateAlgorithm = null;
24 private String protocol = null;
25
26 public HttpsTransportConnector( URI uri ) {
27 super( uri );
28 }
29
30 public void start() throws JMSException {
31 SslListener sslListener = new SslListener();
32 sslListener.setKeystore( keyStore );
33 sslListener.setPassword( keyStorePassword );
34 // if the keyPassword hasn't been set, default it to the
35 // key store password
36 if ( keyPassword == null ) {
37 sslListener.setKeyPassword( keyStorePassword );
38 }
39 if ( keyStoreType != null ) {
40 sslListener.setKeystoreType( keyStoreType );
41 }
42 if ( certificateAlgorithm != null ) {
43 sslListener.setAlgorithm( certificateAlgorithm );
44 }
45 if ( protocol != null ) {
46 sslListener.setProtocol( protocol );
47 }
48
49 setSocketListener( sslListener );
50
51 super.start();
52 }
53
54 // Properties
55 //--------------------------------------------------------------------------------
56
57 public String getCertificateAlgorithm() {
58 return certificateAlgorithm;
59 }
60
61 public void setCertificateAlgorithm( String certificateAlgorithm ) {
62 this.certificateAlgorithm = certificateAlgorithm;
63 }
64
65 public String getKeyStore() {
66 return keyStore;
67 }
68
69 public void setKeyStore( String keyStore ) {
70 this.keyStore = keyStore;
71 }
72
73 public String getKeyPassword() {
74 return keyPassword;
75 }
76
77 public void setKeyPassword( String keyPassword ) {
78 this.keyPassword = keyPassword;
79 }
80
81 public String getKeyStoreType() {
82 return keyStoreType;
83 }
84
85 public void setKeyStoreType( String keyStoreType ) {
86 this.keyStoreType = keyStoreType;
87 }
88
89 public String getKeyStorePassword() {
90 return keyStorePassword;
91 }
92
93 public void setKeyStorePassword( String keyStorePassword ) {
94 this.keyStorePassword = keyStorePassword;
95 }
96
97 public String getProtocol() {
98 return protocol;
99 }
100
101 public void setProtocol( String protocol ) {
102 this.protocol = protocol;
103 }
104
105 }