@Override protected HttpResourceAddress newResourceAddress0(String original, String location) { String host = URIUtils.getHost(location); int port = URIUtils.getPort(location); String path = URIUtils.getPath(location); if (host == null) { throw new IllegalArgumentException(format("Missing host in URI: %s", location)); } if (port == -1) { throw new IllegalArgumentException(format("Missing port in URI: %s", location)); } if (path == null || path.length() == 0) { throw new IllegalArgumentException(format("Missing path in URI: %s", location)); } URI uriLocation = URI.create(location); return new HttpResourceAddress(this, original, uriLocation); }
try { canonicalURI = buildURIAsString(scheme, getUserInfo(uri), host == null ? null : host.toLowerCase(), getPort(uri), path, getQuery(uri), getFragment(uri)); } catch (URISyntaxException ex) { throw new IllegalArgumentException("Invalid URI: " + uri + " in Gateway configuration file", ex);
String ipAddress = inetAddress.getHostAddress(); String addressFormat = (inetAddress instanceof Inet6Address) ? FORMAT_IPV6_AUTHORITY : FORMAT_IPV4_AUTHORITY; String newAuthority = format(addressFormat, ipAddress, getPort(location)); location = modifyURIAuthority(location, newAuthority); TcpResourceAddress tcpAddress = super.newResourceAddress0(original, location, options);
String ipAddress = inetAddress.getHostAddress(); String addressFormat = (inetAddress instanceof Inet6Address) ? FORMAT_IPV6_AUTHORITY : FORMAT_IPV4_AUTHORITY; String newAuthority = format(addressFormat, ipAddress, getPort(location)); location = modifyURIAuthority(location, newAuthority); UdpResourceAddress udpAddress = super.newResourceAddress0(original, location, options);
int port = getPort(uri); if (port == -1) { GL.error("ha", "Port number is missing while processing {} for {}", processing, member);
private String resolveURI(String uri) throws URISyntaxException { String schemeName = getScheme(uri); SchemeConfig schemeConfig = supplySchemeConfig(schemeName); int defaultPort = schemeConfig.getDefaultPort(); if (getPort(uri) == -1) { if (defaultPort == -1) { LOGGER.error("Missing port number in URI \"" + uri + "\". You must include an explicit port number in this URI in your gateway configuration file."); throw new IllegalArgumentException("Missing port for URI \"" + uri + "\""); } if (defaultPort != 0) { String host = getHost(uri); String path = getPath(uri); String query = getQuery(uri); String fragment = getFragment(uri); uri = buildURIAsString(schemeName, null, host, defaultPort, path, query, fragment); } } else { if (defaultPort == 0) { LOGGER.error("Port number not allowed in URI \"" + uri + "\". You must remove the port number from this URI in your gateway configuration file."); throw new IllegalArgumentException("Port not allowed in URI \"" + uri + "\""); } } return uri; }
if (getPort(location) == -1) { location = modifyURIPort(location, getSchemePort());
String port = format("%d", URIUtils.getPort(externalURI)); connectSession.addWriteHeader(HEADER_X_FORWARDED_HOST, format("%s:%s", host, port));
if (getPort(allowOriginURI) == -1) {
URIUtils.getUserInfo(remoteExternalHttp11), URIUtils.getHost(remoteExternalHttp11), URIUtils.getPort(remoteExternalHttp11), createResolvePath(localExternalHttp11, downstreamSuffix + sessionIdSuffix), URIUtils.getQuery(remoteExternalHttp11), URIUtils.getUserInfo(remoteExternalHttp11), URIUtils.getHost(remoteExternalHttp11), URIUtils.getPort(remoteExternalHttp11), createResolvePath(localExternalHttp11, upstreamSuffix + sessionIdSuffix), URIUtils.getQuery(remoteExternalHttp11),