protocol = "https";
} else {
protocol = "http";
}
Connector connector = null;
if (UtilValidate.isNotEmpty(connectorProp.properties)) {
if (address != null) {
/*
* InetAddress.toString() returns a string of the form
* "<hostname>/<literal_IP>". Get the latter part, so that the
* address can be parsed (back) into an InetAddress using
* InetAddress.getByName().
*/
int index = address.indexOf('/');
if (index != -1) {
address = address.substring(index + 1);
}
}
Debug.logInfo("Creating connector for address='" +
((address == null) ? "ALL" : address) +
"' port='" + port + "' protocol='" + protocol + "'", module);
try {
if (protocol.equals("ajp")) {
connector = new Connector("org.apache.coyote.ajp.AjpProtocol");
} else if (protocol.equals("memory")) {
connector = new Connector("org.apache.coyote.memory.MemoryProtocolHandler");
} else if (protocol.equals("http")) {
connector = new Connector();
} else if (protocol.equals("https")) {
connector = new Connector();
connector.setScheme("https");
connector.setSecure(true);
connector.setProperty("SSLEnabled","true");
// FIXME !!!! SET SSL PROPERTIES
} else {
connector = new Connector(protocol);
}
if (address != null) {
IntrospectionUtils.setProperty(connector, "address", "" + address);
}
IntrospectionUtils.setProperty(connector, "port", "" + port);
} catch (Exception e) {
Debug.logError(e, "Couldn't create connector.", module);
}
try {
for (ContainerConfig.Container.Property prop: connectorProp.properties.values()) {
connector.setProperty(prop.name, prop.value);
//connector.setAttribute(prop.name, prop.value);
}
if (connectorProp.properties.containsKey("URIEncoding")) {
connector.setURIEncoding(connectorProp.properties.get("URIEncoding").value);
}
tomcat.getService().addConnector(connector);
} catch (Exception e) {
throw new ContainerException(e);