FELIX-783 Extended initializeHTTPS() to use NIO or traditional IO based on the property.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@738251 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/http.jetty/src/main/java/org/apache/felix/http/jetty/Activator.java b/http.jetty/src/main/java/org/apache/felix/http/jetty/Activator.java
index c417c45..7ac3a1a 100644
--- a/http.jetty/src/main/java/org/apache/felix/http/jetty/Activator.java
+++ b/http.jetty/src/main/java/org/apache/felix/http/jetty/Activator.java
@@ -26,6 +26,7 @@
import org.mortbay.jetty.bio.SocketConnector;
import org.mortbay.jetty.nio.SelectChannelConnector;
import org.mortbay.jetty.security.HashUserRealm;
+import org.mortbay.jetty.security.SslSelectChannelConnector;
import org.mortbay.jetty.security.SslSocketConnector;
import org.mortbay.jetty.servlet.Context;
import org.mortbay.jetty.servlet.OsgiServletHandler;
@@ -342,33 +343,42 @@
// keystore, passwords etc. into it's own pluggable service
protected void initializeHTTPS() throws Exception
{
-
- SslSocketConnector s_listener = new SslSocketConnector();
- s_listener.addLifeCycleListener(
- new ConnectorListener(m_httpsPortProperty)
- );
-
- s_listener.setPort( m_httpsPort );
- s_listener.setMaxIdleTime( 60000 );
-
- if ( m_keystore != null )
- {
- s_listener.setKeystore( m_keystore );
+ if (m_useNIO) {
+ SslSelectChannelConnector s_listener = new SslSelectChannelConnector();
+ s_listener.addLifeCycleListener(new ConnectorListener(m_httpsPortProperty));
+ s_listener.setPort(m_httpsPort);
+ s_listener.setMaxIdleTime(60000);
+ if (m_keystore != null) {
+ s_listener.setKeystore(m_keystore);
+ }
+ if (m_passwd != null) {
+ System.setProperty(SslSelectChannelConnector.PASSWORD_PROPERTY, m_passwd);
+ s_listener.setPassword(m_passwd);
+ }
+ if (m_keyPasswd != null) {
+ System.setProperty(SslSelectChannelConnector.KEYPASSWORD_PROPERTY, m_keyPasswd);
+ s_listener.setKeyPassword(m_keyPasswd);
+ }
+ m_server.addConnector(s_listener);
}
-
- if ( m_passwd != null )
- {
- System.setProperty( SslSocketConnector.PASSWORD_PROPERTY, m_passwd );
- s_listener.setPassword( m_passwd );
+ else {
+ SslSocketConnector s_listener = new SslSocketConnector();
+ s_listener.addLifeCycleListener(new ConnectorListener(m_httpsPortProperty));
+ s_listener.setPort(m_httpsPort);
+ s_listener.setMaxIdleTime(60000);
+ if (m_keystore != null) {
+ s_listener.setKeystore(m_keystore);
+ }
+ if (m_passwd != null) {
+ System.setProperty(SslSocketConnector.PASSWORD_PROPERTY, m_passwd);
+ s_listener.setPassword(m_passwd);
+ }
+ if (m_keyPasswd != null) {
+ System.setProperty(SslSocketConnector.KEYPASSWORD_PROPERTY, m_keyPasswd);
+ s_listener.setKeyPassword(m_keyPasswd);
+ }
+ m_server.addConnector(s_listener);
}
-
- if ( m_keyPasswd != null )
- {
- System.setProperty( SslSocketConnector.KEYPASSWORD_PROPERTY, m_keyPasswd );
- s_listener.setKeyPassword( m_keyPasswd );
- }
-
- m_server.addConnector( s_listener );
}