}
}
private void setHttpsProtForConsole() {
ServerConfiguration config = ServerConfiguration.getInstance();
try {
// Try to get the port information from the Carbon TransportManager
// -- Standalone Mode --
final String TRANSPORT_MANAGER
= "org.wso2.carbon.server.transports.TransportManager";
Class transportManagerClass = Class.forName(TRANSPORT_MANAGER);
Object transportManager = transportManagerClass.newInstance();
Method method = transportManagerClass.getMethod("getPort", String.class);
int httpsPort = (Integer) method.invoke(transportManager, "https");
int httpPort = (Integer) method.invoke(transportManager, "http");
// required to properly log the management console URL
System.setProperty("carbon.https.port", Integer.toString(httpsPort));
System.setProperty("carbon.http.port", Integer.toString(httpPort));
System.setProperty("httpPort", Integer.toString(httpPort));
System.setProperty("httpsPort", Integer.toString(httpsPort));
// this is required for the dashboard to work
config.setConfigurationProperty("RegistryHttpPort", Integer.toString(httpPort));
} catch (ClassNotFoundException e) {
// Try to get the port information from the carbon.xml
// -- Webapp Deployment Mode --
if (log.isDebugEnabled()) {
log.debug("TransportManager implementation not found. Switching to " +
"webapp deployment mode. Reading HTTPS port from the carbon.xml.");
}
String serverURL = config.getFirstProperty("ServerURL");
if (serverURL != null) {
try {
URL url = new URL(serverURL);
if ("https".equals(url.getProtocol())) {
System.setProperty("carbon.https.port", String.valueOf(url.getPort()));