https://issues.jboss.org/browse/WFCORE-3338 read server-config to test name of the server in operation is present
493057
private void readResourceServerConfig(OperationContext context) {
        final PathAddress address = context.getCurrentAddress();
        final String hostName = address.getElement(0).getValue();
        final PathElement element = address.getLastElement();
        final String serverName = element.getValue();

        final ModelNode addr = new ModelNode();
        addr.add(HOST, hostName);
        addr.add(SERVER_CONFIG, serverName);
        context.readResourceFromRoot(PathAddress.pathAddress(addr), false);
    }
44527
private MBeanServer getServerForName(String name) {
        try {
            MBeanServer mbeanServer = null;
            final ObjectName objectNameQuery = new ObjectName(name + ":type=Service,*");

            for (final MBeanServer server : MBeanServerFactory.findMBeanServer(null)) {
                if (server.queryNames(objectNameQuery, null).size() > 0) {
                    mbeanServer = server;
                    // we found it, bail out
                    break;
                }
            }

            return mbeanServer;
        } catch (Exception e) {
        }

        return null;
    }
452948
public void setupServerConfigIfNeeds(BootLogger logger, Tomcat server, Connector connector, Properties props,
            List<String> readConfigList) {
        if (props == null) {
            return;
        }
        logger.info("...Reflecting configuration to server: config=" + readConfigList);
        doSetupServerConfig(logger, props, "URIEncoding", value -> connector.setURIEncoding(value));
        doSetupServerConfig(logger, props, "useBodyEncodingForURI", value -> {
            connector.setUseBodyEncodingForURI(isStringBooleanTrue(value));
        });
        doSetupServerConfig(logger, props, "secure", value -> connector.setSecure(isStringBooleanTrue(value)));
        doSetupServerConfig(logger, props, "scheme", value -> connector.setScheme(value));
        doSetupServerConfig(logger, props, "bindAddress", value -> connector.setProperty("address", value));
        doSetupServerConfig(logger, props, "proxyPort", value -> connector.setProxyPort(toInt("proxyPort(config)", value)));
        doSetupServerConfig(logger, props, "maxHttpHeaderSize", value -> {
            reflectPropertyMaxHttpHeaderSize(logger, server, connector, value);
        });
    }
880316
function verifyConfig(config) {
  var i = 0;
  var required = ['logs', 'client_name', 'server_port'];
  var optional = {
    'server_host': '127.0.0.1'
  };

  for(i = 0; i < required.lenght; i++) {
    if(!config[required[i]]) {
      throw 'Config missing required: ' + required[i];
    }
  }

  for(i in optional) {
    if(optional.hasOwnProperty(i)) {
      if(!config[i]) {
        config[i] = optional[i];
      }
    }
  }

  return config;
}
21160
public static String getValueFromServerConfiguration(final Server server, final String key) {
        if (server == null) {
            return null;
        }

        final Xpp3Dom configuration = (Xpp3Dom) server.getConfiguration();
        if (configuration == null) {
            return null;
        }

        final Xpp3Dom node = configuration.getChild(key);
        if (node == null) {
            return null;
        }

        return node.getValue();
    }
832229
def server_hostname(self):
        
        result = c_char_p(
            self.lib.iperf_get_test_server_hostname(self._test)
        ).value
        if result:
            self._server_hostname = result.decode('utf-8')
        else:
            self._server_hostname = None
        return self._server_hostname
556584
@FFDCIgnore(Exception.class)
    private void checkVCAPHost(ServerInfo server) {
        String VCAP_APPLICATION = System.getenv("VCAP_APPLICATION");
        if (VCAP_APPLICATION != null) {
            try {
                JsonNode node = Json.mapper().readValue(VCAP_APPLICATION, JsonNode.class);
                ArrayNode uris = (ArrayNode) node.get("uris");
                if (uris != null && uris.size() > 0 && uris.get(0) != null) {
                    server.setHost(uris.get(0).textValue());
                    if (OpenAPIUtils.isEventEnabled(tc)) {
                        Tr.event(this, tc, "Changed hostPort using VCAP_APPLICATION.  New value: " + server.getHost());
                    }
                }
            } catch (Exception e) {
                if (OpenAPIUtils.isEventEnabled(tc)) {
                    Tr.event(this, tc, "Exception while parsing VCAP_APPLICATION env: " + e.getMessage());
                }
            }
        }
    }
1304325
private void parseServerHeader(Map<Object, Object> props) {
        // @PK15848
        String value = getProp(props, HttpConfigConstants.PROPNAME_SERVER_HEADER_VALUE);
        if (null == value || "".equals(value)) {
            // due to security change, do not default value in Server header. // PM87013 Start
        } else {
            if ("DefaultServerVersion".equalsIgnoreCase(value)) {
                value = "WebSphere Application Server";
            }
            this.baServerHeaderValue = GenericUtils.getEnglishBytes(value);
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Config: server header value [" + value + "]");
            }
        }
        // PM87013 (PM75371) End

        Object ov = props.get(HttpConfigConstants.PROPNAME_REMOVE_SERVER_HEADER);
        if (null != ov) {
            this.bRemoveServerHeader = convertBoolean(ov);
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Config: remove server header is " + removeServerHeader());
            }
        }
    }
1182116
function () {
		
		LOG.warn('starting [' + SR.Settings.SERVER_INFO.type + '] server at base port: ' + l_ip_port.port, l_name);
		
		// NOTE: name will determine which handler set to get/store
		// create a listener that'll listen to the default socket port for this server
		l_server = new SR.Listener({
			port:           l_ip_port.port + SR.Settings.PORT_INC_SOCKET,
			conn_module:    config.conn_handler
		});
		
		// always load system.js (NOTE: before other handlers)
		SR.Handler.addByFile({name: 'system',	file: 'system.js', owner: 'SR'}, config.path);
		
		// result may be true or false
		l_server.init(function (result) {
			if (result === false) {
				LOG.error('server init fail, listen port: ' + l_ip_port.port, l_name);
				
				// NOTE: this is redundant judgement with frontier's 
				//LOG.warn('treat this server as APP server, loading AppConnector...', l_name);
				//SR.Module.addStep(SR.Component.AppConnector());
				
				// TODO: try to close down more gracefully, right now this will trigger many 
				// unnecessary shutdown steps (& print too many error messages not useful)
				//l_dispose();
			}
			else {
				LOG.warn('server is ready & running...', l_name);
								
				// for entry server, we report the entry server HTTP base port
				// TODO: cleaner approach?
				if (SR.Settings.SERVER_INFO.type === 'entry')
					SR.Settings.SERVER_INFO.port = SR.Settings.PORT_ENTRY_ACTUAL;
				
				// NOTE: this is redundant judgement with frontier's 
				//else if (SR.Settings.SERVER_INFO.type === 'lobby') {
				//	LOG.warn('treat this server as LOBBY server, loading AppManager...', l_name);
				//	SR.Module.addStep(SR.Component.AppManager());
				//}
			}
			
			UTIL.safeCall(onDone, true);
		});
	}
54395
def run_unified_application_check(dns_name, port=8000)
      url_base = "#{dns_name}:#{port}"
      behavior(:test_http_response, "html serving succeeded", "#{url_base}/index.html", port) 
      behavior(:test_http_response, "configuration=succeeded", "#{url_base}/appserver/", port) 
      behavior(:test_http_response, "I am in the db", "#{url_base}/dbread/", port) 
      behavior(:test_http_response, "hostname=", "#{url_base}/serverid/", port) 
    end
837764
@SuppressWarnings("unused")
    private void printServerInfo() {
        Context ctx;
        try{
            ctx = new InitialContext();
            MBeanServer server = (MBeanServer)ctx.lookup("java:comp/env/jmx/runtime");
            ObjectName service = new ObjectName("com.bea:Name=RuntimeService," +
                  "Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean");
            ObjectName domainMBean = (ObjectName) server.getAttribute(service,
                "DomainConfiguration");
            ObjectName[] servers = (ObjectName[]) server.getAttribute(domainMBean,
                    "Servers");
            for (ObjectName one : servers) {
                String name = (String)server.getAttribute(one, "Name");
                String address = (String)server.getAttribute(one, "ListenAddress");
                Integer port = (Integer)server.getAttribute(one, "ListenPort");
                System.out.println("SERVER: " + name + " on " + address + ":" + port);
                ObjectName machine = (ObjectName)server.getAttribute(one, "Machine");
                ObjectName nodeManager = (ObjectName)server.getAttribute(machine, "NodeManager");
                // above line need WLS admin!!!
                address = (String)server.getAttribute(machine, "ListenAddress");
                System.out.println(" - hostname: " + address);
            }
            if (ctx!=null) return;
        }catch(Exception ex){
            ex.printStackTrace();
        }
    }
232593
@Override
  ClientProtocol getNewNameNode(ClientProtocol rpcNamenode, Configuration conf)
      throws IOException {
    ClientProtocol namenode = DFSClient.createNamenode(rpcNamenode, conf);
    if (failoverClient == null) {
      failoverClient = new FailoverClientProtocol(namenode,
          failoverHandler);
    }
    failoverClient.setNameNode(namenode);
    return failoverClient;
  }
9836
protected void setServerName(String serverName) {

        if (CmsStringUtil.isEmpty(serverName) || (WILDCARD.equals(serverName))) {
            m_serverName = WILDCARD;
        } else {
            m_serverName = serverName.trim();
        }
    }
625395
@FFDCIgnore({ XMLStreamException.class })
    public ServerConfiguration parseServerConfiguration(Reader reader, ServerConfiguration config) throws ConfigParserException, ConfigValidationException {
        try {
            XMLStreamReader parser = getXMLInputFactory().createXMLStreamReader(reader);
            if (!parseServerConfiguration(new DepthAwareXMLStreamReader(parser), "test", config, MergeBehavior.MERGE)) {
                config = null;
            }
            parser.close();
            return config;
        } catch (XMLStreamException e) {
            throw new ConfigParserException(e);
        }
    }
1068631
def parse_config(self):
        
        tree = ElementTree.parse(self.file_xml)
        root = tree.getroot()
        for server in root.findall('server'):
            destination = server.text
            name = server.get("name")
            self.discover_remote(destination, name)
1125101
String getHost() {
        LOGGER.entering();
        String val = "";

        InstanceType type = getType();
        if (commands.contains(HOST_ARG)) {
            val = commands.get(commands.indexOf(HOST_ARG) + 1);
            LOGGER.exiting(val);
            return val;
        }

        try {
            if (type.equals(InstanceType.SELENIUM_NODE) || type.equals(InstanceType.SELENIUM_HUB)) {
                val = getSeleniumConfigAsJsonObject().get("host").getAsString();
            }
        } catch (JsonParseException | NullPointerException e) {
            // ignore
        }

        // return the value if it looks okay, otherwise return "localhost" as a last ditch effort
        val = (StringUtils.isNotEmpty(val) && !val.equalsIgnoreCase("ip")) ? val : "localhost";
        LOGGER.exiting(val);
        return val;
    }
239784
function createServers(conf) {
  var seenKeys = map.create();

  var servers = _.map(conf.search('server'), function(serverNode) {
    var listenNode = serverNode.getOne('listen');
    if (!listenNode)
      throwForNode(serverNode,
          new Error('Required "listen" directive is missing'));

    var port = serverNode.getValues('listen').port;
    if (typeof port === 'undefined')
      port = 80;
    if (port <= 0)
      throwForNode(listenNode, new Error('Invalid port number'));

    var host = serverNode.getValues('listen').host || '::';
    if (host === '*')
      host = '::';

    if (!iputil.isValid(host)) {
      throwForNode(listenNode,
          new Error('Invalid IP address "' + host + '"'));
    }

    if (iputil.hasZone(host)) {
      throwForNode(listenNode,
          new Error(`Invalid IP address "${host}"--zone IDs are not currently supported`))
    }

    var serverNames = serverNode.getValues('server_name').names;

    // Read all locations. Use post-order traversal so that nested locs
    // get priority over their parents.
    var locations = _.chain(serverNode.search('location', false, true))
    .map(createLocation)
    .compact()
    .value();

    // We get the templateDir at the server level so that a global or server-
    // wide templateDir can be attached to the request directly. We may need
    // this if a page gets returns without a matching AppSpec (like a 404).
    var templateDir = serverNode.getValues('template_dir').dir;

    _.each(serverNames || [''], function(serverName) {
      var key = host + ':' + port;
      if (serverName !== '')
        key += '(' + serverName + ')';
      if (seenKeys[key])
        throwForNode(listenNode,
            new Error(key + ' combination conflicts with earlier server definition'));
      seenKeys[key] = true;
    });

    return new ServerRouter(port, host, serverNames, locations, templateDir);
  });

  return servers;
}