Returns a new {@code HttpUrl} representing {@code url} if it is a well-formed HTTP or HTTPS
URL, or null if it isn't.
969449
public static HttpUrl parse(String url) {
        Builder builder = new Builder();
        Builder.ParseResult result = builder.parse(null, url);
        return result == Builder.ParseResult.SUCCESS ? builder.build() : null;
    }
236322
public URI baseURL() {
        StringBuilder b = new StringBuilder()
                .append(protocol())
                .append(host())
                .append(":")
                .append(port())
                .append("/")
                .append(versionPrefix())
                .append("/");
        try {
            return new URI(b.toString());
        } catch (URISyntaxException e) {
            throw new IllegalArgumentException("Unable to construct a base URL for the API", e);
        }
    }
906003
protected URL extractURL(Object url)
    throws IOException {
    if (!(url instanceof String)) {
      return null;
    }
    return (null == url || "".equals(url)) ? null : new URL( (String) url);
  }
425932
public static InputStream fromURL(URL url) throws IOException {
		if(url != null) {
			return url.openStream();
		}
		return null;
	}
965347
public static String getRequestLink(String url) {

        if (CmsStringUtil.isEmpty(url)) {
            return null;
        }
        int pos = url.indexOf(URL_DELIMITER);
        if (pos >= 0) {
            return url.substring(0, pos);
        }
        return url;

    }
402879
public String getUrl() {
        if (url == null) {
            RequestHandle request = getRequest();
            url = LinkUtil.getUrl(request, getPath(), request.getSelectors(), null);
        }
        return url;
    }
338977
public static URL createURL(String str) throws ParseException
    {
        try
        {
            return new URL(str);
        }
        catch (MalformedURLException e)
        {
            throw new ParseException("Unable to parse the URL: " + str);
        }
    }
775557
protected final StringBuilder getBaseUrl(final HttpServletRequest httpServletRequest) {
        StringBuilder baseURL = new StringBuilder();
        if (httpServletRequest.getContextPath() != null && !httpServletRequest.getContextPath().isEmpty()) {
            baseURL.append(httpServletRequest.getContextPath());
        }
        if (httpServletRequest.getServletPath() != null && !httpServletRequest.getServletPath().isEmpty()) {
            baseURL.append(httpServletRequest.getServletPath());
        }
        return baseURL;
    }
520223
public static XPathUtils newXPath(final URL url) {
        final DefaultHttpClient client = new DefaultHttpClientImpl();
        final GetMethod method = new GetMethod(url.toExternalForm());
        try {
            final int responseCode = client.executeMethod(method);
            if (responseCode != HttpStatus.SC_OK) {
                LOG.warn("Unexpected response code: " + responseCode);
            } else {
                final InputStream is = method.getResponseBodyAsStream();
                return XPathUtils.newXPath(is);
            }
        } catch (final HttpException e) {
            LOG.warn("Could not handle XPath", e);
        } catch (final IOException e) {
            LOG.warn("Could not handle XPath", e);
        } catch (final SAXException e) {
            LOG.warn("Could not handle XPath", e);
        } finally {
            method.releaseConnection();
        }
        return null;
    }
1076355
private static String encodeUrl(String url) {
        try {
            URL u = new URL(url);
            return encodeUrl(u).toExternalForm();
        } catch (Exception e) {
            return url;
        }
	}
257462
public String getUrl() {
        final StringBuilder sb = new StringBuilder();

        sb.append(secured() ? "https://" : "http://")
          .append(website())
          .append(path())
          .append(name())
          .append(extension());

        return sb.toString();
    }
1268980
public com.google.api.Http getHttp() {
    return http_ == null ? com.google.api.Http.getDefaultInstance() : http_;
  }
352530
public String getUrl() {
		if (StringUtils.isBlank(url) && !StringUtils.isBlank(name)) {
			this.url = AWSQueueUtils.createQueue(name);
		}
		return url;
	}
1028490
public URLConnection asURLConnection() {
        URLConnection uc = getURLConnection();
        if (uc != null) return uc;
        try {
            return new InputStreamURLConnection(
                    getResourceURLOrSystemId(), 
                    this, 
                    getDefaultUrlConnectionHeader());
        } catch (Exception e) {
            throw resolvingException(e);
        }
    }
244503
public ApplicationResource addJsUrl(final String url) {
		if (Util.empty(url)) {
			throw new IllegalArgumentException("A URL must be provided.");
		}
		ApplicationResource res = new ApplicationResource(url);
		addJsResource(res);
		return res;
	}
780258
public RequestBuilder put(final String url) {

    checkNotNull(url, "url may not be null");
    final AsyncHttpClient.BoundRequestBuilder ningRequestBuilder = asyncHttpClient.preparePut(url);
    return createNewRequestBuilder(url, ningRequestBuilder);
  }
971162
protected URL resolveURL() {
		if (this.clazz != null) {
			return this.clazz.getResource(this.path);
		}
		else if (this.classLoader != null) {
			return this.classLoader.getResource(this.path);
		}
		else {
			return ClassLoader.getSystemResource(this.path);
		}
	}