Returns the initial cropping parameter bean for a given resource.<p>

@param resourcePath the resource path
@param callback the callback to execute
501952
private void getInitialCroppingParameter(
        final String resourcePath,
        final I_CmsSimpleCallback<CmsCroppingParamBean> callback) {

        getImageInfo(resourcePath, new I_CmsSimpleCallback<CmsImageInfoBean>() {

            public void execute(CmsImageInfoBean imageInfo) {

                CmsImageFormatHandler formatHandler = new CmsImageFormatHandler(
                    getGalleryMode(),
                    getGalleryDialog(),
                    resourcePath,
                    imageInfo.getHeight(),
                    imageInfo.getWidth());
                CmsCroppingParamBean param = formatHandler.getCroppingParam();
                if (formatHandler.isUseFormats()) {
                    formatHandler.getFormats().values().iterator().next().adjustCroppingParam(param);
                }
                callback.execute(param);
            }
        });

    }
774921
private String getCompletePath(String resourcePath) {
		String path = PathNormalizer.normalizePath(classpathPrefix + resourcePath);
		return path;
	}
873148
public static boolean isPluginResoucePath(String resourcePath) {

		Matcher matcher = PLUGIN_RESOURCE_PATTERN.matcher(resourcePath);
		return matcher.find();
	}
15568
public void loadPath(final String sitePath, final AsyncCallback<CmsClientSitemapEntry> callback) {

        loadPath(sitePath, false, callback);
    }
1161939
public static URI getResourceURI(String classpath) {
        try {
            return getResourceURL(classpath).toURI();
        } catch (Exception e) {
            return JMExceptionManager.handleExceptionAndReturnNull(log, e,
                    "getResourceURI", classpath);
        }
    }
1086012
public boolean isGeneratedBinaryResource(String resourcePath) {

		boolean isGeneratedImage = false;

		ResourceGenerator generator = resolveResourceGenerator(resourcePath);
		if (generator != null && binaryResourceGeneratorRegistry.contains(generator)) {
			isGeneratedImage = true;
		}

		return isGeneratedImage;
	}
1226598
protected boolean isBinaryResource(String resourcePath) {
		String extension = FileNameUtils.getExtension(resourcePath);
		if (extension != null) {
			extension = extension.toLowerCase();
		}
		return MIMETypesSupport.getSupportedProperties(this).containsKey(extension);
	}
1173255
public static String getHost(String resourcePath) {
        String hostSpec;
        if (resourcePath.contains(":")) {
            hostSpec = resourcePath.split(":")[0];
        } else {
            hostSpec = resourcePath;
        }

        if (hostSpec.contains("/")) {
            hostSpec = hostSpec.substring(0, hostSpec.indexOf('/'));
        }

        return hostSpec;
    }
161381
public @Nonnull Optional<ResourceLoader> getLoaderForBasePath(@Nonnull String basePath) {
        ArgumentUtils.requireNonNull("basePath", basePath);
        Optional<ResourceLoader> resourceLoader = getSupportingLoader(basePath);
        return resourceLoader.map(rl -> rl.forBase(basePath));
    }
168320
public void touchResource(String resourcePath) throws Exception {

        CmsResource resource = m_cms.readResource(resourcePath);
        CmsLockActionRecord action = CmsLockUtil.ensureLock(m_cms, resource);
        try {
            OpenCms.getWorkplaceManager().flushMessageCache();
            // One important reason for touching resources via the shell is to write mapped values containing
            // localization macros to properties, so we flush the workplace messages immediately before the touch operation
            // in case an older version of the workplace messages (not containing the keys we need) has already been cached
            touchSingleResource(m_cms, resourcePath, System.currentTimeMillis(), true, true, true);
        } finally {
            if (action.getChange() == LockChange.locked) {
                m_cms.unlockResource(resource);
            }
        }
    }
259028
public T headerFragment(Object model, String mapperName) {
        Assert.notNull(applicationContext, "Citrus application context is not initialized!");

        if (applicationContext.containsBean(mapperName)) {
            Object mapper = applicationContext.getBean(mapperName);

            if (Marshaller.class.isAssignableFrom(mapper.getClass())) {
                return headerFragment(model, (Marshaller) mapper);
            } else if (ObjectMapper.class.isAssignableFrom(mapper.getClass())) {
                return headerFragment(model, (ObjectMapper) mapper);
            } else {
                throw new CitrusRuntimeException(String.format("Invalid bean type for mapper '%s' expected ObjectMapper or Marshaller but was '%s'", mapperName, mapper.getClass()));
            }
        }

        throw new CitrusRuntimeException("Unable to find default object mapper or marshaller in application context");
    }
826106
@Override
	public String getFilePath(String resourcePath) {

		String filePath = null;
		List<ResourceBrowser> list = new ArrayList<>();
		list.addAll(resourceInfoProviders);
		for (Iterator<ResourceBrowser> iterator = list.iterator(); iterator.hasNext() && filePath == null;) {
			ResourceBrowser rsBrowser = iterator.next();
			if (generatorRegistry.isPathGenerated(resourcePath)) {
				if (rsBrowser instanceof ResourceGenerator) {
					ResourceGenerator rsGeneratorBrowser = (ResourceGenerator) rsBrowser;
					if (rsGeneratorBrowser.getResolver().matchPath(resourcePath)) {
						filePath = rsBrowser.getFilePath(resourcePath);
					}
				}
			} else {
				if (!(rsBrowser instanceof ResourceGenerator)) {
					filePath = rsBrowser.getFilePath(resourcePath);
				}
			}
		}
		return filePath;
	}
373739
private static Set<URL> getResourcesFromRoot(final String rootPath) {

        final Set<URL> rets = new LinkedHashSet<URL>();

        String path = rootPath;

        if (path.startsWith("/")) {
            path = path.substring(1);
        }

        try {
            final Enumeration<URL> resources = Thread.currentThread().getContextClassLoader().getResources(path);
            URL url = null;

            while (resources.hasMoreElements()) {
                url = (URL) resources.nextElement();

                rets.add(url);
            }
        } catch (final IOException e) {
            LOGGER.log(Level.ERROR, "get the ROOT Rescources error", e);
        }
        return rets;
    }
470668
@Override
	public String getFilePath(String resourcePath) {

		String filePath = null;
		String path = getCompletePath(resourcePath);
		URL url = null;
		try {
			url = ClassLoaderResourceUtils.getResourceURL(path, this);
			String strURL = url.toString();
			if (strURL.startsWith(JawrConstant.FILE_URL_PREFIX)) {
				filePath = new File(url.getFile()).getAbsolutePath();
			} else if (strURL.startsWith(JawrConstant.JAR_URL_PREFIX + JawrConstant.FILE_URL_PREFIX)) {
				String tmp = strURL.substring((JawrConstant.JAR_URL_PREFIX + JawrConstant.FILE_URL_PREFIX).length());
				int idxJarContentSeparator = tmp.indexOf("!");
				if (idxJarContentSeparator != -1) {
					tmp = tmp.substring(0, idxJarContentSeparator);
				}
				filePath = new File(tmp).getAbsolutePath();
			}
		} catch (ResourceNotFoundException e) {
			filePath = null;
		}

		return filePath;
	}
144795
public void openPreview(String resourcePath, String resourceType) {

        if (m_currentPreview != null) {
            m_currentPreview.removePreview();
        }
        String provider = getProviderName(resourceType);
        if (m_previewFactoryRegistration.containsKey(provider)) {
            m_handler.m_galleryDialog.useMaxDimensions();
            m_currentPreview = m_previewFactoryRegistration.get(provider).getPreview(m_handler.m_galleryDialog);
            m_currentPreview.openPreview(resourcePath, !m_resultsSelectable);
            m_handler.hideShowPreviewButton(false);
        } else {
            CmsDebugLog.getInstance().printLine(
                "Preview provider \"" + provider + "\" has not been registered properly.");
        }
    }
104306
public function render($request_path) {

        // Get crop path relative to it's dir
        $crop_path = $this->url->relativePath($request_path);

        // If the crops_dir is a remote disk and if the crop has already been
        // created.  If it has, just return that path.
        if ($this->storage->cropsAreRemote()
            && $this->storage->cropExists($crop_path)) {
            return $crop_path;
        }

        // Parse the path.  In the case there is an error (the pattern on the route
        // SHOULD have caught all errors with the pattern) just return
        if (!$params = $this->url->parse($request_path)) return;
        list($path, $width, $height, $options) = $params;

        // Check if there are too many crops already
        if ($this->storage->tooManyCrops($path)) throw new Exception('Croppa: Max crops');

        // Increase memory limit, cause some images require a lot to resize
        if ($this->config['memory_limit'] !== null) {
            ini_set('memory_limit', $this->config['memory_limit']);
        }

        // Build a new image using fetched image data
        $image = new Image(
            $this->storage->readSrc($path),
            $this->url->phpThumbConfig($options)
        );

        // Process the image and write its data to disk
        $this->storage->writeCrop($crop_path,
            $image->process($width, $height, $options)->get()
        );

        // Return the paht to the crop, relative to the storage disk
        return $crop_path;
    }
8788
static Config loadOvercastConfigFromClasspath(String path) {
        try {
            // resource.toURI().getPath() so path gets URL decoded so spaces are no issue
            // using resource.getPath() runs into a bug with guava
            return loadOvercastConfigFromFile(Resources.getResource(path).toURI().getPath());
        } catch (IllegalArgumentException | NullPointerException | URISyntaxException e) {
            logger.warn("File '{}' not found on classpath.", path);
        }
        return ConfigFactory.empty();
    }