deployedFile = out;
}
private void overrideAddresses() {
final File serverXml = new File(catalinaBase, "conf/server.xml");
final QuickServerXmlParser parser = QuickServerXmlParser.parse(serverXml);
String value = read(serverXml);
if (tomeeHttpsPort != null && tomeeHttpsPort > 0 && parser.value("HTTPS", null) == null) {
// ensure connector is not commented
value = value.replace("<Service name=\"Catalina\">", "<Service name=\"Catalina\">\n"
+ " <Connector port=\"" + tomeeHttpsPort + "\" protocol=\"HTTP/1.1\" SSLEnabled=\"true\"\n" +
" scheme=\"https\" secure=\"true\"\n" +
" clientAuth=\"false\" sslProtocol=\"TLS\" />\n");
}
if (tomeeHttpsPort == null) {
// avoid NPE
tomeeHttpsPort = 8443;
}
FileWriter writer = null;
try {
writer = new FileWriter(serverXml);
writer.write(value
.replace(parser.http(), Integer.toString(tomeeHttpPort))
.replace(parser.https(), Integer.toString(tomeeHttpsPort))
.replace(parser.ajp(), Integer.toString(tomeeAjpPort))
.replace(parser.stop(), Integer.toString(tomeeShutdownPort))
.replace(parser.host(), tomeeHost)
.replace(parser.appBase(), webappDir));
} catch (IOException e) {
throw new TomEEException(e.getMessage(), e);
} finally {
close(writer);
}