Takes a given {@link BannerText} and fetches a valid
imageBaseUrl if one is found.

@param bannerText to provide the base URL
353576
private void fetchImageBaseUrls(BannerText bannerText) {
    for (BannerComponents components : bannerText.components()) {
      if (nodeVerifier.hasImageUrl(components)) {
        picassoImageLoader.load(urlDensityMap.get(components.imageBaseUrl())).fetch();
      }
    }
  }
583764
public static String rewriteGeneratedBinaryResourceDebugUrl(String requestPath, String content, String binaryServletMapping) {

		// Write the content of the CSS in the Stringwriter
		if (binaryServletMapping == null) {
			binaryServletMapping = "";
		}

		// Define the replacement pattern for the generated binary resource
		// (like jar:img/myImg.png)
		String relativeRootUrlPath = PathNormalizer.getRootRelativePath(requestPath);
		String replacementPattern = PathNormalizer
				.normalizePath("$1" + relativeRootUrlPath + binaryServletMapping + "/$5_cbDebug/$7$8");

		Matcher matcher = GENERATED_BINARY_RESOURCE_PATTERN.matcher(content);

		// Rewrite the images define in the classpath, to point to the image
		// servlet
		StringBuffer result = new StringBuffer();
		while (matcher.find()) {
			matcher.appendReplacement(result, replacementPattern);
		}
		matcher.appendTail(result);

		return result.toString();
	}
1327519
public static <IMAGE extends ImageView> void doLoadImageUrl(@NonNull IMAGE view, @Nullable String url) {
        Preconditions.checkState(sImageSetter != null, "ImageSetter must be initialized before calling image load");
        sImageSetter.doLoadImageUrl(view, url);
    }
611140
@SuppressWarnings("UnusedDeclaration")
    private String createDataURI(final URL imageURL) {
        return imgCache.computeIfAbsent(imageURL, url -> {
            String dataUrl = null;
            try (final InputStream isGuess = url.openStream();
                 final InputStream isConvert = url.openStream();
                 final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
                final String contentType = URLConnection.guessContentTypeFromStream(isGuess);
                if (null != contentType) {
                    final byte[] chunk = new byte[4096];
                    int bytesRead;
                    while ((bytesRead = isConvert.read(chunk)) > 0) {
                        os.write(chunk, 0, bytesRead);
                    }
                    os.flush();
                    dataUrl = "data:" + contentType + ";base64," + Base64.getEncoder().encodeToString(os
                            .toByteArray());
                } else {
                    if (logger.isWarnEnabled()) {
                        logger.warn("could not get content type from {}", imageURL.toExternalForm());
                    }
                }
            } catch (final IOException e) {
                if (logger.isWarnEnabled()) {
                    logger.warn("error loading image", e);
                }
            }
            if (null == dataUrl) {
                if (logger.isWarnEnabled()) {
                    logger.warn("could not create data url from {}", imageURL.toExternalForm());
                }
            }
            return dataUrl;
        });
    }
100842
public function iShouldSeeAVailidThumbnailForImageWithAlternativeText($imageAlternativeText)
    {
        $image = $this->getXpath()->findXpath("//img[contains(@alt, '" . $imageAlternativeText . "')]");

        if (count($image) == 0) {
            throw new \Exception(sprintf('Image with an alternative text `%s` was not found', $imageAlternativeText));
        }

        $file = $image[0]->getAttribute('src');

        $client = new \Guzzle\Http\Client();
        $request = $client->get($this->locatePath($file));
        $response = $request->send();

        Assertion::equalTo(
            $response->getStatusCode(), 200
        );

        Assertion::assertRegexp(
            '/image\/(.*)/', $response->getHeader('content-type')->__toString()
        );
    }
1011691
private void updateDataFromBannerText(@NonNull BannerText primaryBannerText, BannerText secondaryBannerText) {
    if (secondaryBannerText == null) {
      loadPrimary(primaryBannerText);
      return;
    }
    loadPrimaryAndSecondary(primaryBannerText, secondaryBannerText);
  }
245381
private URL getUrl(TestContext context) {
        try {
            return new URL(context.replaceDynamicContentInString(this.url));
        } catch (MalformedURLException e) {
            throw new CitrusRuntimeException("Invalid request url", e);
        }
    }
671443
public ArmeriaRetrofitBuilder baseUrl(String baseUrl) {
        requireNonNull(baseUrl, "baseUrl");
        final URI uri = URI.create(baseUrl);
        checkArgument(SessionProtocol.find(uri.getScheme()).isPresent(),
                      "baseUrl must have an HTTP scheme: %s", baseUrl);
        final String path = uri.getPath();
        if (!path.isEmpty() && !SLASH.equals(path.substring(path.length() - 1))) {
            throw new IllegalArgumentException("baseUrl must end with /: " + baseUrl);
        }
        this.baseUrl = baseUrl;
        return this;
    }
39182
function fillBaseUrl(url, baseUrl) {
  if (url.indexOf('//') > -1) {
    return url;
  }
  baseUrl = baseUrl || apiConf.baseUrl;

  return `${baseUrl}${url}`;
}
677369
public void setImageUrl(final String imageUrl) {
		LinkModel model = getOrCreateComponentModel();
		model.imageUrl = imageUrl;
		model.image = null;
	}
219038
public boolean acceptsURL(String url) {

        if (url == null) {
            return false;
        }

        return url.regionMatches(true, 0, DatabaseURL.S_URL_PREFIX, 0,
                                 DatabaseURL.S_URL_PREFIX.length());
    }
346700
public static Document parseBase64(String base64Data, Element instruction)
            throws Exception {
        byte[] imageData = Base64.decodeBase64(base64Data);
        ByteArrayInputStream bais = new ByteArrayInputStream(imageData);
        StringWriter swLogger = new StringWriter();
        PrintWriter pwLogger = new PrintWriter(swLogger);
        return parse(bais, instruction, pwLogger);
    }
1255960
public static Url getBaseUrl(final Class<? extends Page> pageClass,
		final PageParameters parameters)
	{
		return RequestCycle.get().mapUrlFor(pageClass, parameters);
	}
824654
public static String getImageLink(String imagePath) {

        return CmsStringUtil.joinPaths(
            OpenCms.getSystemInfo().getContextPath(),
            "VAADIN/themes/opencms/img-extra",
            imagePath);
    }
284010
public static String resolveURI(final String baseURI, final Parent parent, String url) {

        if (!resolveURIs) {
            return url;
        }

        if (isRelativeURI(url)) {

            if (".".equals(url) || "./".equals(url)) {
                url = "";
            }

            if (url.startsWith("/") && baseURI != null) {
                String base = null;
                final int slashslash = baseURI.indexOf("//");
                final int nextslash = baseURI.indexOf("/", slashslash + 2);
                if (nextslash != -1) {
                    base = baseURI.substring(0, nextslash);
                }
                return formURI(base, url);
            }

            // Relative URI with parent
            if (parent != null && parent instanceof Element) {

                // Do we have an xml:base?
                String xmlbase = ((Element) parent).getAttributeValue("base", Namespace.XML_NAMESPACE);
                if (xmlbase != null && xmlbase.trim().length() > 0) {
                    if (isAbsoluteURI(xmlbase)) {
                        // Absolute xml:base, so form URI right now
                        if (url.startsWith("/")) {
                            // Host relative URI
                            final int slashslash = xmlbase.indexOf("//");
                            final int nextslash = xmlbase.indexOf("/", slashslash + 2);
                            if (nextslash != -1) {
                                xmlbase = xmlbase.substring(0, nextslash);
                            }
                            return formURI(xmlbase, url);
                        }
                        if (!xmlbase.endsWith("/")) {
                            // Base URI is filename, strip it off
                            xmlbase = xmlbase.substring(0, xmlbase.lastIndexOf("/"));
                        }
                        return formURI(xmlbase, url);
                    } else {
                        // Relative xml:base, so walk up tree
                        return resolveURI(baseURI, parent.getParent(), stripTrailingSlash(xmlbase) + "/" + stripStartingSlash(url));
                    }
                }
                // No xml:base so walk up tree
                return resolveURI(baseURI, parent.getParent(), url);

                // Relative URI with no parent (i.e. top of tree), so form URI
                // right now
            } else if (parent == null || parent instanceof Document) {
                return formURI(baseURI, url);
            }
        }

        return url;

    }
256446
protected void updateBaseUrl() {
        Log.d(IMapView.LOGTAG, "updateBaseUrl");
        final String subDomain = mImageryData.getSubDomain();
        final int idx = mImageryData.m_imageUrl.lastIndexOf("/");
        if (idx > 0) {
            mBaseUrl = mImageryData.m_imageUrl.substring(0, idx);
        } else {
            mBaseUrl = mImageryData.m_imageUrl;
        }

        mUrl = mImageryData.m_imageUrl;
        if (subDomain != null) {
            mBaseUrl = String.format(mBaseUrl, subDomain);
            mUrl = String.format(mUrl, subDomain, "%s", mLocale);
        }
        Log.d(IMapView.LOGTAG, "updated url = " + mUrl);
        Log.d(IMapView.LOGTAG, "end updateBaseUrl");
    }
892667
@Override
    public void loadImageThumbnail(ImageView iv, String imageUrl, int dimension) {
        imageThumbnailLoader.loadImageThumbnail(iv, imageUrl, dimension);
    }