Generate a URL token for the given URL.

@param url the URL to be authorized
@return a URL token
554555
public String generate(String url) {
        long expiration = this.expiration;
        if (expiration == 0) {
            if (duration > 0) {
                final long start = startTime > 0 ? startTime : Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTimeInMillis() / 1000L;
                expiration = start + duration;
            } else {
                throw new IllegalArgumentException("Must provide either expiration or duration");
            }
        }
        ArrayList<String> tokenParts = new ArrayList<String>();
        if (ip != null) {
            tokenParts.add("ip=" + ip);
        }
        if (startTime > 0) {
            tokenParts.add("st=" + startTime);
        }
        tokenParts.add("exp=" + expiration);
        if (acl != null) {
            tokenParts.add("acl=" + escapeToLower(acl));
        }
        ArrayList<String> toSign = new ArrayList<String>(tokenParts);
        if (url != null && acl == null) {
            toSign.add("url=" + escapeToLower(url));
        }
        String auth = digest(StringUtils.join(toSign, "~"));
        tokenParts.add("hmac=" + auth);
        return tokenName + "=" + StringUtils.join(tokenParts, "~");

    }
459489
@Trivial
    public static URL createWSJPAURL(URL url) throws MalformedURLException {
        if (url == null) {
            return null;
        }

        // Encode the URL to be embedded into the wsjpa URL's path
        final String encodedURLPathStr = encode(url.toExternalForm());

        URL returnURL;
        try {
            returnURL = AccessController.doPrivileged(new PrivilegedExceptionAction<URL>() {
                @Override
                @Trivial
                public URL run() throws MalformedURLException {
                    return new URL(WSJPA_PROTOCOL_NAME + ":" + encodedURLPathStr);
                }
            });
        } catch (PrivilegedActionException e) {
            throw (MalformedURLException) e.getException();
        }

        return returnURL;
    }
639725
public Request createGetRequest(String url, String apiKey, String accessToken) {
        HttpUrl.Builder httpBuilder = HttpUrl.parse(url).newBuilder();
        return new Request.Builder().url(httpBuilder.build()).header("User-Agent", USER_AGENT).header("X-Kite-Version", "3").header("Authorization", "token "+apiKey+":"+accessToken).build();
    }
354320
public void addURL(final URL url) {
		AccessController.doPrivileged(new PrivilegedAction<Object>() {
			@Override
			public Object run() {
				DynamicURLClassLoader.this.ucp.addURL(url);
				return null;
			}
		}, this.acc);
	}
729383
public String redirectUrl(String token) {
        return play.shaded.oauth.oauth.signpost.OAuth.addQueryParameters(
                provider.getAuthorizationWebsiteUrl(),
                play.shaded.oauth.oauth.signpost.OAuth.OAUTH_TOKEN,
                token
        );
    }
906003
protected URL extractURL(Object url)
    throws IOException {
    if (!(url instanceof String)) {
      return null;
    }
    return (null == url || "".equals(url)) ? null : new URL( (String) url);
  }
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();
  }
297203
public static URI urlToURI(URL url) {
    try {
      return url.toURI();
    }
    catch (URISyntaxException e) {
      throw LOG.cannotConvertUrlToUri(url, e);
    }
  }
791793
public String getURL(String url, Object optParam, boolean keepSettings) throws IOException {
		StringBuilder SB=new StringBuilder();
		SB.append(url);
		List<String> finishedParams=new SortedArrayList<>();
		boolean alreadyAppended=appendParams(SB, optParam, finishedParams, false);
		if(keepSettings) appendSettings(finishedParams, alreadyAppended, SB);
		return SB.toString();
	}
1300612
@Override
    public void addURL(URL url)
    {
        this.finder.addURI(URI.create(url.toExternalForm()));
    }
177613
private boolean isInvalidURL(String url) {
        try {
            final URL u = new URL(url);
            u.toURI();
        } catch (MalformedURLException | URISyntaxException e) {
            LOGGER.trace("URL is invalid: {}", url);
            return true;
        }
        return false;
    }
1117601
public static URL correct(final URL url) throws MalformedURLException {
        if (url == null) {
            throw new MalformedURLException("The url is null");
        }
        return new URL(correct(url.toString(), false));
    }
627371
public RequestBuilder get(final String url) {

    checkNotNull(url, "url may not be null");
    final AsyncHttpClient.BoundRequestBuilder ningRequestBuilder = asyncHttpClient.prepareGet(url);
    return createNewRequestBuilder(url, ningRequestBuilder);
  }
627064
public static String getURLPath(String url) {
		url = stripURLScheme(url);
		int pathIdx = url.indexOf(UrlOperations.PATH_START);
		if(pathIdx == -1) {
			return "/";
		}
		return url.substring(pathIdx);
	}
1100731
public static boolean isValidUrl(String url) {
        try {
            if (Strings.isNullOrEmpty(url)) {
                return false;
            }
            new URL(url);
            return true;
        } catch (MalformedURLException e) {
            return false;
        }
    }
1007939
public void setURL(String url) {
		try {
			this.value = (url != null) ? new URL(url) : null;
		} catch (Throwable exception) {
			this.value = null;
		}
		this.type = AttributeType.URL;
		this.assigned = this.value != null;
	}
488551
public RFuture<String> get(String url) {
    return req(url).execute().map(GET_PAYLOAD);
  }