Displays an image given by the uri.

@param uri uri of the image
@param callerContext caller context
972444
public void setImageURI(Uri uri, @Nullable Object callerContext) {
    DraweeController controller =
        mControllerBuilder
            .setCallerContext(callerContext)
            .setUri(uri)
            .setOldController(getController())
            .build();
    setController(controller);
  }
1082418
public DataSource<CloseableReference<CloseableImage>> fetchImageFromBitmapCache(
      ImageRequest imageRequest,
      Object callerContext) {
    return fetchDecodedImage(
        imageRequest,
        callerContext,
        ImageRequest.RequestLevel.BITMAP_MEMORY_CACHE);
  }
907219
public static File getFile(Context context, Uri uri) {
        if (uri != null) {
            String path = getPath(context, uri);
            if (path != null && isLocal(path)) {
                return new File(path);
            }
        }
        return null;
    }
245381
private URL getUrl(TestContext context) {
        try {
            return new URL(context.replaceDynamicContentInString(this.url));
        } catch (MalformedURLException e) {
            throw new CitrusRuntimeException("Invalid request url", e);
        }
    }
751147
public static Observable<Bitmap> getThumbnail(Context context, Uri uri) {
    return getThumbnailFromUri(context, uri);
  }
892667
@Override
    public void loadImageThumbnail(ImageView iv, String imageUrl, int dimension) {
        imageThumbnailLoader.loadImageThumbnail(iv, imageUrl, dimension);
    }
705579
public void proxyTo(final URI uri) {
		if(uri == null) {
			throw new NullPointerException("URI can't be null");
		}
		if(!JainSipUtils.checkScheme(uri.toString())) {
			// Fix for Issue http://code.google.com/p/mobicents/issues/detail?id=2327, checking the route header
			RouteHeader routeHeader = (RouteHeader) originalRequest.getMessage().getHeader(RouteHeader.NAME);
			if(routeHeader == null || (routeHeader != null && !JainSipUtils.checkScheme(routeHeader.getAddress().getURI().toString()))) {
				throw new IllegalArgumentException("Scheme " + uri.getScheme() + " is not supported");
			}			
		}
		final ProxyBranchImpl branch = new ProxyBranchImpl(uri, this);
		branch.setRecordRoute(recordRoutingEnabled);
		branch.setRecurse(recurse);
		this.proxyBranches.put(uri, branch);
		startProxy();

	}
872582
private void loadArtwork(final Context context, final String artworkUrl) {
        mMainThreadHandler.post(new Runnable() {
            @Override
            public void run() {
                final Picasso picasso = Picasso.with(context);
                picasso.cancelRequest(mMediaSessionArtworkTarget);
                picasso.load(artworkUrl)
                        .centerCrop()
                        .resize(MEDIA_SESSION_ARTWORK_SIZE, MEDIA_SESSION_ARTWORK_SIZE)
                        .into(mMediaSessionArtworkTarget);
            }
        });
    }
1249837
public final void setBackgroundImage(URL imageUrl) {
        if (imageUrl != null) {
            try {
                img = ImageIO.read(imageUrl);
                
            } catch (IOException ioe) {
                // do nothing
            }
        }        
    }
1288338
private static Observable<Bitmap> getThumbnailFromUri(final Context context, final Uri data) {
    return getThumbnailFromUriWithSizeAndKind(context, data, 0, 0,
        MediaStore.Images.Thumbnails.MINI_KIND);
  }
1006223
@VisibleForTesting
  static URI sourceURI(URI uri) {
    if (!uri.getScheme().equals("jar")) {
      return uri;
    }
    try {
      return URI.create(
          "file:/" + ((JarURLConnection) uri.toURL().openConnection()).getEntryName());
    } catch (IOException e) {
      throw new UncheckedIOException(e);
    }
  }
155341
public GenericDraweeHierarchyBuilder setRetryImage(
      int resourceId, @Nullable ScalingUtils.ScaleType retryImageScaleType) {
    mRetryImage = mResources.getDrawable(resourceId);
    mRetryImageScaleType = retryImageScaleType;
    return this;
  }
11959
private void handleThumbnailLink(
        CmsObject cms,
        HttpServletRequest request,
        HttpServletResponse response,
        String uri)
    throws Exception {

        String options = request.getParameter(CmsPdfThumbnailLink.PARAM_OPTIONS);
        if (CmsStringUtil.isEmptyOrWhitespaceOnly(options)) {
            options = "w:64";
        }
        CmsPdfThumbnailLink linkObj = new CmsPdfThumbnailLink(cms, uri, options);
        CmsResource pdf = linkObj.getPdfResource();
        CmsFile pdfFile = cms.readFile(pdf);
        CmsPdfThumbnailGenerator thumbnailGenerator = new CmsPdfThumbnailGenerator();
        // use a wrapped resource because we want the cache to store files with the correct (image file) extensions
        CmsWrappedResource wrapperWithImageExtension = new CmsWrappedResource(pdfFile);
        wrapperWithImageExtension.setRootPath(pdfFile.getRootPath() + "." + linkObj.getFormat());
        String cacheName = m_thumbnailCache.getCacheName(
            wrapperWithImageExtension.getResource(),
            options + ";" + linkObj.getFormat());
        byte[] imageData = m_thumbnailCache.getCacheContent(cacheName);
        if (imageData == null) {
            imageData = thumbnailGenerator.generateThumbnail(
                new ByteArrayInputStream(pdfFile.getContents()),
                linkObj.getWidth(),
                linkObj.getHeight(),
                linkObj.getFormat(),
                linkObj.getPage());
            m_thumbnailCache.saveCacheFile(cacheName, imageData);
        }
        response.setContentType(IMAGE_MIMETYPES.get(linkObj.getFormat()));
        response.getOutputStream().write(imageData);
        CmsResourceInitException initEx = new CmsResourceInitException(CmsPdfResourceHandler.class);
        initEx.setClearErrors(true);
        throw initEx;

    }
1193362
@Override
    public URI getLocationURI(HttpRequest request, HttpResponse response, HttpContext context) throws ProtocolException {
        URI uri = this.redirectStrategy.getLocationURI(request, response, context);

        String resultingPageUrl = uri.toString();

        DriverRequest driverRequest = ((OutgoingRequest) request).getOriginalRequest();

        // Remove context if present
        if (StringUtils.startsWith(resultingPageUrl, driverRequest.getVisibleBaseUrl())) {
            resultingPageUrl =
                    "/"
                            + StringUtils.stripStart(
                                    StringUtils.replace(resultingPageUrl, driverRequest.getVisibleBaseUrl(), ""), "/");
        }
        resultingPageUrl = ResourceUtils.getHttpUrlWithQueryString(resultingPageUrl, driverRequest, false);

        return UriUtils.createURI(ResourceUtils.getHttpUrlWithQueryString(resultingPageUrl, driverRequest, false));
    }
921426
Drawable getDrawableFromResourceUri(Uri uri) throws FileNotFoundException {
        String authority = uri.getAuthority();
        Resources r;
        if (TextUtils.isEmpty(authority)) {
            throw new FileNotFoundException("No authority: " + uri);
        } else {
            try {
                r = mContext.getPackageManager().getResourcesForApplication(authority);
            } catch (NameNotFoundException ex) {
                throw new FileNotFoundException("No package found for authority: " + uri);
            }
        }
        List<String> path = uri.getPathSegments();
        if (path == null) {
            throw new FileNotFoundException("No path: " + uri);
        }
        int len = path.size();
        int id;
        if (len == 1) {
            try {
                id = Integer.parseInt(path.get(0));
            } catch (NumberFormatException e) {
                throw new FileNotFoundException("Single path segment is not a resource ID: " + uri);
            }
        } else if (len == 2) {
            id = r.getIdentifier(path.get(1), path.get(0), authority);
        } else {
            throw new FileNotFoundException("More than two path segments: " + uri);
        }
        if (id == 0) {
            throw new FileNotFoundException("No resource found for: " + uri);
        }
        return r.getDrawable(id);
    }
194577
public static void validateURI(String uri) throws ServiceException {
        if (uri == null || uri.isEmpty() || !validateRequiredField(uri, urlRegEx) || !isValidBrace(uri)) {
            throw new ServiceException(ErrorCode.SERVICE_INSTANCE_URI_FORMAT_ERROR);
        }
    }
102080
public void setURI(URI uri) {
		if(SipServletMessageImpl.isSystemHeader(isModifiable)) {
			throw new IllegalStateException("this Address is used in a context where it cannot be modified");
		}
		this.getAddress().setURI(((URIImpl) uri).uri);
	}