Gets authority of a url.

@param url
the url to get the authority for.
@return the authority.
516113
public String getAuthority(HttpUrl url) {
        String scheme = url.scheme();
        String host = url.host();
        int port = url.port();
        StringBuilder builder = new StringBuilder();
        if (scheme != null) {
            builder.append(scheme).append("://");
        }
        builder.append(host);
        if (port >= 0) {
            builder.append(':').append(port);
        }
        return builder.toString();
    }
470502
public String get(String url) throws AuthenticationException, ApiException {
		return performRequest(url, "GET", null, null, null);
	}
1214925
private String getValidURL(String url)
	{
		if (url != null && url.length() > 0)
		{
			// XXX really important that this one happens first!!
			return url.replaceAll("[%]", "%25")
				.replaceAll(" ", "%20")
				.replaceAll("[<]", "%3c")
				.replaceAll("[>]", "%3e")
				.replaceAll("[\"]", "%3f")
			.replaceAll("[#]", "%23")
			.replaceAll("[{]", "%7b")
			.replaceAll("[}]", "%7d")
			.replaceAll("[|]", "%7c")
			.replaceAll("[\\\\]", "%5c") // double check this
													// one :-)
			.replaceAll("[\\^]", "%5e")
			.replaceAll("[~]", "%7e")
			.replaceAll("[\\[]", "%5b")
			.replaceAll("[\\]]", "%5d")
			.replaceAll("[']", "%27")
			.replaceAll("[?]", "%3f");
		}

		return url;

	}
1247904
public static URI authorityToUri(String authority) {
    Preconditions.checkNotNull(authority, "authority");
    URI uri;
    try {
      uri = new URI(null, authority, null, null, null);
    } catch (URISyntaxException ex) {
      throw new IllegalArgumentException("Invalid authority: " + authority, ex);
    }
    return uri;
  }
806281
public void setUrl(String url) {
        if (url != null && url.trim().length() > 0) {
            if (Url.isUrl(url)) {
                this.url = url;
            } else {
                throw new IllegalArgumentException(url + " is not a valid URL.");
            }
        }
    }
975018
public function getAuthority()
    {
        $authority = null;

        if (null !== $this->host) {

            if (null !== $this->userinfo) {
                $authority .= $this->userinfo . '@';
            }
            $authority .= $this->host;
            if (null !== $this->port) {
                $authority .= ':' . $this->port;
            }
        }

        return $authority;
    }
886791
private void parseH2Authority(byte[] data) {
        if (data.length == 0) {
            throw new IllegalArgumentException("Invalid authority: " + GenericUtils.getEnglishString(data));
        }
        int i = 0;
        int host_start = i;
        for (; i < data.length; i++) {
            // find either a "@" or "/"
            if ('@' == data[i]) {
                // Note: we're just cutting off the userinfo section for now
                host_start = i + 1;
            }
        }
        parseURLHost(data, host_start, data.length);
    }
843490
public static InputStream get(@javax.annotation.Nonnull String url) throws NoSuchAlgorithmException, KeyManagementException, IOException {
    @javax.annotation.Nonnull final TrustManager[] trustManagers = {
      new X509TrustManager() {
        @Override
        public void checkClientTrusted(
          final X509Certificate[] certs, final String authType) {
        }
        
        @Override
        public void checkServerTrusted(
          final X509Certificate[] certs, final String authType) {
        }
        
        @javax.annotation.Nonnull
        @Override
        public X509Certificate[] getAcceptedIssuers() {
          return new X509Certificate[0];
        }
      }
    };
    @javax.annotation.Nonnull final SSLContext ctx = SSLContext.getInstance("TLS");
    ctx.init(null, trustManagers, null);
    final SSLSocketFactory sslFactory = ctx.getSocketFactory();
    final URLConnection urlConnection = new URL(url).openConnection();
    if (urlConnection instanceof HttpsURLConnection) {
      @javax.annotation.Nonnull final HttpsURLConnection conn = (HttpsURLConnection) urlConnection;
      conn.setSSLSocketFactory(sslFactory);
      conn.setRequestMethod("GET");
    }
    return urlConnection.getInputStream();
  }
308129
private HttpGet prepareGet(final String url) {
    final HttpGet httpGet = new HttpGet(this.instanceUrl + url);
    for (final Header header : this.headers) {
      httpGet.addHeader(header);
    }
    return httpGet;
  }
359356
public GetSignatureResponse getSignature(String url) {
        BeanUtil.requireNonNull(url, "请传入当前网页的URL，不包含#及其后面部分");
        //当前时间的秒数
        long timestame = System.currentTimeMillis() / 1000;
        //使用UUID来当随机字符串
        String nonceStr = UUID.randomUUID().toString().replaceAll("-", "");
        return getSignature(nonceStr, timestame, url);
    }
1361549
public java.lang.String getAuthorizationUrl() {
    java.lang.Object ref = authorizationUrl_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      authorizationUrl_ = s;
      return s;
    }
  }
462003
public static String getAbsoluteUrl(SlingHttpServletRequest request, String url) {
        if (!isExternalUrl(url) && url.startsWith("/")) {
            String scheme = request.getScheme().toLowerCase();
            url = scheme + "://" + getAuthority(request) + url;
        }
        return url;
    }
865685
public static String getUrl(final URL url, final Properties requestProps, final Integer timeout) throws Exception {
        return HttpUtils.doGET(url, requestProps, timeout, false, false);

    }
239332
public com.google.protobuf.ByteString
      getAuthorizationUrlBytes() {
    java.lang.Object ref = authorizationUrl_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      authorizationUrl_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }
1076448
public static String getUrl(Object o) {
        if ( o instanceof VerifierRule ) {
            VerifierRule rule = (VerifierRule) o;
            return getRuleUrl( UrlFactory.RULE_FOLDER,
                               rule.getPath(),
                               rule.getName() );
        }

        return o.toString();
    }
580516
public static String getUrl(final String url) throws Exception {
        return getUrl(new URL(url), null, null);
    }
137347
public static UrlBuilder parse(String url) {
        final UrlBuilder result = new UrlBuilder();
        result.with(url, UrlTokenizerState.SCHEME_OR_HOST);
        return result;
    }