Skip to content

Commit

Permalink
[WFLY-2211] For domain management we may have http, https or both.
Browse files Browse the repository at this point in the history
This commit corrects an issue where a NullPointerException was encountered when only https was defined.
  • Loading branch information
darranl committed Jan 24, 2014
1 parent ed585ca commit b56a2e1
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 9 deletions.
Expand Up @@ -158,14 +158,19 @@ public static void installHttpManagementServices(final RunningMode runningMode,
.install();

if(httpUpgrade) {


ServiceName serverCallbackService = ServiceName.JBOSS.append("host", "controller", "server-inventory", "callback");
ServiceName tmpDirPath = ServiceName.JBOSS.append("server", "path", "jboss.domain.temp.dir");
ManagementRemotingServices.installSecurityServices(serviceTarget, ManagementRemotingServices.HTTP_CONNECTOR, securityRealm, serverCallbackService, tmpDirPath, verificationHandler, newControllers);

NativeManagementServices.installRemotingServicesIfNotInstalled(serviceTarget, hostControllerInfo.getLocalHostName(), verificationHandler, null, serviceRegistry,onDemand);
RemotingHttpUpgradeService.installServices(serviceTarget, ManagementRemotingServices.HTTP_CONNECTOR, ManagementRemotingServices.HTTP_CONNECTOR, ManagementRemotingServices.MANAGEMENT_ENDPOINT, OptionMap.EMPTY, verificationHandler, newControllers);
final String httpConnectorName;
if (port > -1 || securePort < 0) {
httpConnectorName = ManagementRemotingServices.HTTP_CONNECTOR;
} else {
httpConnectorName = ManagementRemotingServices.HTTPS_CONNECTOR;
}

RemotingHttpUpgradeService.installServices(serviceTarget, ManagementRemotingServices.HTTP_CONNECTOR, httpConnectorName, ManagementRemotingServices.MANAGEMENT_ENDPOINT, OptionMap.EMPTY, verificationHandler, newControllers);
}

}
Expand Down
Expand Up @@ -72,10 +72,7 @@ void launchServices(OperationContext context, String connectorName, ModelNode mo

final ServiceTarget target = context.getServiceTarget();
final String connectorRef = HttpConnectorResource.CONNECTOR_REF.resolveModelAttribute(context, model).asString();
RemotingHttpUpgradeService.installServices(target, connectorName, connectorRef, RemotingServices.SUBSYSTEM_ENDPOINT, optionMap, verificationHandler, newControllers);

//TODO: install upgrade service


RemotingHttpUpgradeService.installServices(target, connectorName, connectorRef, RemotingServices.SUBSYSTEM_ENDPOINT, optionMap, verificationHandler, newControllers);
}
}
@@ -1,3 +1,25 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2013, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/

package org.jboss.as.remoting;

import org.jboss.as.network.SocketBinding;
Expand Down
Expand Up @@ -70,6 +70,7 @@ private ManagementRemotingServices() {

public static final String MANAGEMENT_CONNECTOR = "management";
public static final String HTTP_CONNECTOR = "http-management";
public static final String HTTPS_CONNECTOR = "https-management";

/**
* Installs a remoting stream server for a domain instance
Expand Down
Expand Up @@ -263,11 +263,17 @@ static void installHttpManagementConnector(final OperationContext context, final
if(httpUpgrade) {
final String hostName = WildFlySecurityManager.getPropertyPrivileged(ServerEnvironment.NODE_NAME, null);


ServiceName tmpDirPath = ServiceName.JBOSS.append("server", "path", "jboss.server.temp.dir");
RemotingServices.installSecurityServices(serviceTarget, ManagementRemotingServices.HTTP_CONNECTOR, securityRealm, null, tmpDirPath, verificationHandler, newControllers);
NativeManagementServices.installRemotingServicesIfNotInstalled(serviceTarget, hostName, verificationHandler, null, context.getServiceRegistry(false));
RemotingHttpUpgradeService.installServices(serviceTarget, ManagementRemotingServices.HTTP_CONNECTOR, ManagementRemotingServices.HTTP_CONNECTOR, ManagementRemotingServices.MANAGEMENT_ENDPOINT, OptionMap.EMPTY, verificationHandler, newControllers);
final String httpConnectorName;
if (port > -1 || socketBindingServiceName != null || (securePort < 0 && secureSocketBindingServiceName == null)) {
httpConnectorName = ManagementRemotingServices.HTTP_CONNECTOR;
} else {
httpConnectorName = ManagementRemotingServices.HTTPS_CONNECTOR;
}

RemotingHttpUpgradeService.installServices(serviceTarget, ManagementRemotingServices.HTTP_CONNECTOR, httpConnectorName, ManagementRemotingServices.MANAGEMENT_ENDPOINT, OptionMap.EMPTY, verificationHandler, newControllers);
}

}
Expand Down

0 comments on commit b56a2e1

Please sign in to comment.