public Connector createConnector(InetAddress address, int port,
String protocol) {
Connector connector = null;
try {
Class clazz =
Class.forName("org.apache.coyote.tomcat5.CoyoteConnector");
connector = (Connector) clazz.newInstance();
if (address != null) {
IntrospectionUtils.setProperty(connector, "address",
"" + address);
}
IntrospectionUtils.setProperty(connector, "port", "" + port);
if (protocol.equals("ajp")) {
IntrospectionUtils.setProperty
(connector, "protocolHandlerClassName",
"org.apache.jk.server.JkCoyoteHandler");
} else if (protocol.equals("memory")) {
IntrospectionUtils.setProperty
(connector, "protocolHandlerClassName",
"org.apache.coyote.memory.MemoryProtocolHandler");
} else if (protocol.equals("https")) {
connector.setScheme("https");
connector.setSecure(true);
try {
Class serverSocketFactoryClass = Class.forName
("org.apache.coyote.tomcat5.CoyoteServerSocketFactory");
ServerSocketFactory factory =
(ServerSocketFactory)
serverSocketFactoryClass.newInstance();
connector.setFactory(factory);
} catch (Exception e) {
log.error("Couldn't load SSL server socket factory.");
}
}