Add a new server mapping to current profile

@param sourceHost source hostname
@param destinationHost destination hostname
@param hostHeader host header
@return ServerRedirect
483787
public ServerRedirect addServerMapping(String sourceHost, String destinationHost, String hostHeader) {
        JSONObject response = null;

        ArrayList<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
        params.add(new BasicNameValuePair("srcUrl", sourceHost));
        params.add(new BasicNameValuePair("destUrl", destinationHost));
        params.add(new BasicNameValuePair("profileIdentifier", this._profileName));
        if (hostHeader != null) {
            params.add(new BasicNameValuePair("hostHeader", hostHeader));
        }

        try {
            BasicNameValuePair paramArray[] = new BasicNameValuePair[params.size()];
            params.toArray(paramArray);
            response = new JSONObject(doPost(BASE_SERVER, paramArray));
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
        return getServerRedirectFromJSON(response);
    }
456028
public List<ServerRedirect> deleteServerMapping(int serverMappingId) {
        ArrayList<ServerRedirect> servers = new ArrayList<ServerRedirect>();
        try {
            JSONArray serverArray = new JSONArray(doDelete(BASE_SERVER + "/" + serverMappingId, null));
            for (int i = 0; i < serverArray.length(); i++) {
                JSONObject jsonServer = serverArray.getJSONObject(i);
                ServerRedirect server = getServerRedirectFromJSON(jsonServer);
                if (server != null) {
                    servers.add(server);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }

        return servers;
    }
1338522
private function redirect_default(string $destination) {
		extract(self::get_header_string(301));
		static::start_header($code, 0, [
			"Location: $destination",
		]);
		$dst = htmlspecialchars($destination, ENT_QUOTES);
		echo "<!doctype html>
<html>
	<head>
		<meta charset='utf-8'/>
		<meta name=viewport
			content='width=device-width, initial-scale=1.0,
				user-scalable=yes'>
		<title>$code $msg</title>
		<style>
			body {background-color: #eee; font-family: sans-serif;}
			div  {background-color: #fff; border: 1px solid #ddd;
			      padding: 25px; max-width:800px;
			      margin:20vh auto 0 auto; text-align:center;}
		</style>
	</head>
	<body>
		<div>
			<h1>$code $msg</h1>
			<p>See <tt>&#039;<a href='$dst'>$dst</a>&#039;</tt>.</p>
		</div>
	</body>
</html>";
		static::halt();
	}
310367
public static DestinationUrl createDestinationUrl(String destination) {
        String[] split = splitDestination(destination);
        String host = split[0].trim();
        String jmsDestination = split[1].trim();
        return new DestinationUrl(host, jmsDestination);
    }
1344189
@Override
    public Server addServer(String serverName, String hostAddress, int port) throws Exception {
        return addServer(serverName, hostAddress, port, IpChannelType.SCTP, false, 0, null);
    }
779396
function chRoute(client, serverType, msg, cb) {
    const servers = client._station.serversMap[serverType];
    if (!servers || !servers.length) {
        utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
        return;
    }
    let con;
    if (!client.chParam) {
        client.chParam = {};
    }
    if (client.chParam[serverType]) {
        con = client.chParam[serverType].consistentHash;
    } else {
        client.opts.station = client._station;
        con = new ConsistentHash(servers, client.opts);
    }
    const hashFieldIndex = client.opts.hashFieldIndex;
    const field = msg.args[hashFieldIndex] || JSON.stringify(msg);
    utils.invokeCallback(cb, null, con.getNode(field));
    client.chParam[serverType] = { consistentHash: con };
}
673025
@Override
    public final synchronized boolean addHost(Host host, boolean refresh) {
        // Already exists
        if (hosts.containsKey(host)) {
            // Check to see if we are adding token ranges or if the token ranges changed
            // which will force a rebuild of the token topology
            Host existingHost = hosts.get(host).getHost();
            if (existingHost.getTokenRanges().size() != host.getTokenRanges().size()) {
                existingHost.setTokenRanges(host.getTokenRanges());
                return true;
            }
            
            ArrayList<TokenRange> currentTokens = Lists.newArrayList(existingHost.getTokenRanges());
            ArrayList<TokenRange> newTokens     = Lists.newArrayList(host.getTokenRanges());
            Collections.sort(currentTokens, compareByStartToken);
            Collections.sort(newTokens,     compareByStartToken);
            for (int i = 0; i < currentTokens.size(); i++) {
                if (!currentTokens.get(i).getStartToken().equals(newTokens.get(i).getStartToken()) ||
                    !currentTokens.get(i).getEndToken().equals(newTokens.get(i).getEndToken())) {
                    return false;
                }
            }
            
            existingHost.setTokenRanges(host.getTokenRanges());
            return true;
        }
        else {
            HostConnectionPool<CL> pool = newHostConnectionPool(host, factory, config);
            if (null == hosts.putIfAbsent(host, pool)) {
                try {
                    monitor.onHostAdded(host, pool);
                    if (refresh) {
                        topology.addPool(pool);
                        rebuildPartitions();
                    }
                    pool.primeConnections(config.getInitConnsPerHost());
                }
                catch (Exception e) {
                    // Ignore, pool will have been marked down internally
                }
                return true;
            }
            else {
                return false;
            }
        }
    }
653068
public static InetSocketAddress createSocketAddr(String target, int defaultPort) {
		int colonIndex = target.indexOf(':');
		if (colonIndex < 0 && defaultPort == -1) {
			throw new RuntimeException("Not a host:port pair: " + target);
		}
		String hostname = "";
		int port = -1;
		if (!target.contains("/")) {
			if (colonIndex == -1) {
				hostname = target;
			} else {
				// must be the old style <host>:<port>
				hostname = target.substring(0, colonIndex);
				port = Integer.parseInt(target.substring(colonIndex + 1));
			}
		} else {
			// a new uri
			try {
				URI addr = new URI(target);
				hostname = addr.getHost();
				port = addr.getPort();
			} catch (URISyntaxException use) {
				LOG.fatal(use);
			}
		}

		if (port == -1) {
			port = defaultPort;
		}

		if (getStaticResolution(hostname) != null) {
			hostname = getStaticResolution(hostname);
		}
		return new InetSocketAddress(hostname, port);
	}
843495
public void addAliasToConfigSite(String alias, String redirect, String offset) {

        long timeOffset = 0;
        try {
            timeOffset = Long.parseLong(offset);
        } catch (Throwable e) {
            // ignore
        }
        CmsSiteMatcher siteMatcher = new CmsSiteMatcher(alias, timeOffset);
        boolean redirectVal = new Boolean(redirect).booleanValue();
        siteMatcher.setRedirect(redirectVal);
        m_aliases.add(siteMatcher);
    }
887409
private synchronized HostServerGroupEffect getHostEffect(PathAddress address, String host, Resource root)  {
        if (requiresMapping) {
            map(root);
            requiresMapping = false;
        }
        Set<String> mapped = hostsToGroups.get(host);
        if (mapped == null) {
            // Unassigned host. Treat like an unassigned profile or socket-binding-group;
            // i.e. available to all server group scoped roles.
            // Except -- WFLY-2085 -- the master HC is not open to all s-g-s-rs
            Resource hostResource = root.getChild(PathElement.pathElement(HOST, host));
            if (hostResource != null) {
                ModelNode dcModel = hostResource.getModel().get(DOMAIN_CONTROLLER);
                if (!dcModel.hasDefined(REMOTE)) {
                    mapped = Collections.emptySet(); // prevents returning HostServerGroupEffect.forUnassignedHost(address, host)
                }
            }
        }
        return mapped == null ? HostServerGroupEffect.forUnassignedHost(address, host)
                : HostServerGroupEffect.forMappedHost(address, mapped, host);

    }
425321
public void addExportPoint(String uri, String destination) {

        CmsExportPoint point = new CmsExportPoint(uri, destination);
        m_exportPoints.add(point);
        if (CmsLog.INIT.isInfoEnabled() && (point.getDestinationPath() != null)) {
            CmsLog.INIT.info(
                Messages.get().getBundle().key(
                    Messages.INIT_ADD_EXPORT_POINT_2,
                    point.getUri(),
                    point.getDestinationPath()));
        }
    }
83952
public static Builder newBuilder(TableId sourceTable, List<String> destinationUris) {
    return new Builder().setSourceTable(sourceTable).setDestinationUris(destinationUris);
  }
1184088
function addRedirectRoute(server, scaffold) {
        assert(scaffold.path && scaffold.target, `TransomScaffold redirectRoute requires 'path' and 'target' to be specified.`);

        server.get(scaffold.path, function (req, res, next) {
            res.redirect(scaffold.target, next);
        });
    }
1292679
public static Builder newBuilder(TableId destinationTable, List<String> sourceUris) {
    return new Builder().setDestinationTable(destinationTable).setSourceUris(sourceUris);
  }
136063
public void addForwardedField(int sourceField, int destinationField) {
		FieldSet fs;
		if((fs = this.forwardedFields.get(sourceField)) != null) {
			fs.add(destinationField);
		} else {
			fs = new FieldSet(destinationField);
			this.forwardedFields.put(sourceField, fs);
		}
	}
565266
public static String newDomainUrl(final String scheme, final String domainName, final int port,
		final boolean withServerPort, final boolean withSlashAtTheEnd)
	{
		final StringBuilder domainUrl = new StringBuilder();
		domainUrl.append(scheme);
		domainUrl.append("://");
		domainUrl.append(domainName);
		if (withServerPort)
		{
			domainUrl.append(":");
			domainUrl.append(port);
		}
		if (withSlashAtTheEnd)
		{
			domainUrl.append("/");
		}
		return domainUrl.toString();
	}
1126920
public final void addServer(String hostList) throws IOException {
    Map<InetSocketAddress, InetSocketAddress> addresses = AddrUtil.getAddressMap(hostList);
    if (addresses != null && addresses.size() > 0) {
      for (Map.Entry<InetSocketAddress, InetSocketAddress> entry : addresses.entrySet()) {
        final InetSocketAddress mainNodeAddr = entry.getKey();
        final InetSocketAddress standbyNodeAddr = entry.getValue();
        this.connect(new InetSocketAddressWrapper(mainNodeAddr,
            this.serverOrderCount.incrementAndGet(), 1, null));
        if (standbyNodeAddr != null) {
          this.connect(new InetSocketAddressWrapper(standbyNodeAddr,
              this.serverOrderCount.incrementAndGet(), 1, mainNodeAddr));
        }
      }
    }
  }