*/
public PECoyoteConnector createConnector(HttpListener httpListener,
HttpService httpService){
int port = 8080;
PECoyoteConnector connector;
checkHostnameUniqueness(httpListener.getId(), httpService);
try {
port = Integer.parseInt(httpListener.getPort());
} catch (NumberFormatException nfe) {
String msg = _rb.getString("pewebcontainer.http_listener.invalid_port");
msg = MessageFormat.format(msg,
new Object[] {httpListener.getPort(),
httpListener.getId() });
throw new IllegalArgumentException(msg);
}
/*
* Create Connector. Connector is SSL-enabled if
* 'security-enabled' attribute in <http-listener>
* element is set to TRUE.
*/
boolean isSecure = httpListener.isSecurityEnabled();
if (isSecure && defaultRedirectPort == -1) {
defaultRedirectPort = port;
}
String address = httpListener.getAddress();
if ("any".equals(address) || "ANY".equals(address)
|| "INADDR_ANY".equals(address)) {
address = null;
/*
* Setting 'address' to NULL will cause Tomcat to pass a
* NULL InetAddress argument to the java.net.ServerSocket
* constructor, meaning that the server socket will accept
* connections on any/all local addresses.
*/
}
connector =
(PECoyoteConnector)_embedded.createConnector(address,port,
isSecure);
connector.setName(httpListener.getId());
configureConnector(connector,httpListener,isSecure,httpService);
if ( _logger.isLoggable(Level.FINE)){
_logger.log(Level.FINE, "create.listenerport",
new Object[] {Integer.valueOf(port), connector});
}
_embedded.addConnector(connector);
connectorMap.put(httpListener.getId(), connector);
// If we already know the redirect port, then set it now
// This situation will occurs when dynamic reconfiguration occurs
if ( defaultRedirectPort != -1 ){
connector.setRedirectPort(defaultRedirectPort);
}
return connector;
}