Gets REST url.

@param urlKey Url key.
@return Final REST url.
@throws UnsupportedEncodingException
514069
public String getRestUrl(String urlKey) throws UnsupportedEncodingException {
        return getRestUrl(urlKey, true, null, null);
    }
280482
@Nullable
    public String getUrl() {
        if (getRepositoryUrl() == null)
            return null;
        return getRepositoryUrl() + "/" + getGroupId().replace('.', '/') + "/" + getArtifactId() + "/" + getVersion() + "/" + getFileNameWithBaseVersion();
    }
1057286
public String encodeUrl() {
		// Use the URI class to properly URL encode the value.
		try {
			URI valueUri = new URI(null, null, value, null);
			return key + "=" + valueUri.toString();
		}
		catch (URISyntaxException e) {
			// This should really never happen...
			return key + "=" + "value";
		}
	}
271082
public String getRequestURL()
    {
    	HttpServletRequest httpReq = getRequest();
    	if (httpReq==null)
    		return null;
    	else
    		return httpReq.getRequestURL().toString();
    }
381213
@Nullable
  public String encodeURL (@Nullable final String sUrl)
  {
    if (StringHelper.hasText (m_sEncodeUrlSuffix))
      return StringHelper.getNotNull (sUrl) + m_sEncodeUrlSuffix;
    return sUrl;
  }
1317161
@Override
  public URL getURL() throws IOException {
    URL url = this.servletContext.getResource(this.path);
    if (url == null) { throw new FileNotFoundException(getDescription()
        + " cannot be resolved to URL because it does not exist"); }
    return url;
  }
733351
public function getUrlCahceKey($com,$langcode,$suffix,$segments){
		$key='url:'.$com.':'.$langcode.$suffix;
		$seg='';
		if(is_array($segments)){
			foreach($segments as $k=>$v){
				if(is_object($v)){
					$v=json_encode($v);
					}
				$seg.=$k.'='.$v.',';
				}
			}
		$key.=':'.SHA1($seg);
		return $key;
		}
386155
public String getRemoteUrl(String defaultRemoteUrl) {
        if (StringUtils.isBlank(defaultRemoteUrl)) {
            RemoteConfig remoteConfig = getJenkinsScm().getRepositories().get(0);
            URIish uri = remoteConfig.getURIs().get(0);
            return uri.toPrivateString();
        }

        return defaultRemoteUrl;
    }
287549
public URL getResource(String uriInContext)
        throws MalformedURLException
    {        
        if (uriInContext==null || !uriInContext.startsWith("/"))
            throw new MalformedURLException(uriInContext);
        
        try{
            Resource resource = getHttpContext().getResource(uriInContext);
            if (resource!=null && resource.exists())
                return resource.getURL();
        }
        catch(IllegalArgumentException e)
        {
            LogSupport.ignore(log,e);
        }
        catch(MalformedURLException e)
        {
            throw e;
        }
        catch(IOException e)
        {
            log.warn(LogSupport.EXCEPTION,e);
        }
        return null;
    }
678407
public static String urlNonFormEncode(final String s)
        {
        if (StringUtils.isBlank(s))
            {
            LOG.warn("Could not encode blank string");
            throw new IllegalArgumentException("Blank string");
            }
        try
            {
            // We use the HttpClient encoder because the java URLEncoder
            // class uses form encoding.
            return URIUtil.encodeQuery(s, "UTF-8");
            }
        catch (final URIException e)
            {
            LOG.error ("Could not encode: " + s, e);
            
            // This really should never happen.
            assert false;
            return s;
            }
        }
321867
public String getStringBody() throws UnsupportedEncodingException {
        if (mStringBody != null)
            return mStringBody;

        if (mContentType != null) {
            switch (mContentType) {
                case JSON:
                    JsonObject jsonBody = new JsonObject();
                    for (Map.Entry<String, Object> entry : mBodyMap.entrySet()) {
                        parseHashMapEntry(jsonBody, entry);
                    }
                    mStringBody = jsonBody.toString();
                    break;
                case URL_ENCODED:
                    HashMap<String, String> stringMap = new HashMap<String, String>();
                    for (Map.Entry<String, Object> entry : mBodyMap.entrySet()) {
                        stringMap.put(entry.getKey(), (String) entry.getValue());
                    }
                    mStringBody = createQuery(stringMap);
                    break;
                case JSON_PATCH:
                    mStringBody = ((BoxArray) mBodyMap.get(JSON_OBJECT)).toJson();
                    break;
            }
        }

        return mStringBody;
    }
759594
private static URL getPersistenceRootUrl(URL url)
    {
        String f = url.getFile();
        f = parseFilePath(f);

        URL jarUrl = url;
        try
        {
            if (AllowedProtocol.isJarProtocol(url.getProtocol()))
            {
                jarUrl = new URL(f);
                if (jarUrl.getProtocol() != null
                        && AllowedProtocol.FILE.name().equals(jarUrl.getProtocol().toUpperCase())
                        && StringUtils.contains(f, " "))
                {
                    jarUrl = new File(f).toURI().toURL();
                }
            }
            else if (AllowedProtocol.isValidProtocol(url.getProtocol()))
            {
                if (StringUtils.contains(f, " "))
                {
                    jarUrl = new File(f).toURI().toURL();
                }
                else
                {
                    jarUrl = new File(f).toURL();
                }
            }
        }
        catch (MalformedURLException mex)
        {
            log.error("Error during getPersistenceRootUrl(), Caused by: {}.", mex);
            throw new IllegalArgumentException("Invalid jar URL[] provided!" + url);
        }

        return jarUrl;
    }
1329907
@Override
	public String getUrl() {
		StringBuilder sb = new StringBuilder();
		int hostId = random.nextInt(URL_HOSTS.length);
		String host = String.format(URL_HOSTS[hostId], getWords(1));
		sb.append(host);
		return sb.toString();
	}
1279252
public static String urlDecode(String part) {
		try {
			return URLDecoder.decode(part, Charsets.UTF_8_NAME);
		} catch (UnsupportedEncodingException e) { // NOSONAR
			// this exception is only for detecting and handling invalid inputs
			return null;
		}
	}
790460
@SuppressWarnings("deprecation")
    public static String urlUnescape(String s) {
        try {
            return URLDecoder.decode(s, "UTF8");
        } catch (UnsupportedEncodingException e) {
            // should be impossible; all JVMs must support UTF8
            // but have a fallback just in case
            return URLDecoder.decode(s);
        }
    }
78569
public String urlEncode(String s) {
        if (s == null || s.isEmpty()) {
            return s;
        }

        return URL.encodeQueryString(s);
    }
985428
public static String urlDecode(final String part) {
		try {
			return URLDecoder.decode(part, DEFAULT_URL_ENCODING);
		} catch (UnsupportedEncodingException e) {
			throw new ImpossibleException(e);
		}
	}