/** * Returns the rewritten image path * * @param originalCssPath * the original Css path * @param newCssPath * the new Css path * @param url * the image URL * @return the rewritten image path * @throws IOException * if an IOException occurs */ protected String getRewrittenImagePath(String originalCssPath, String newCssPath, String url) { // Here we generate the full path of the CSS image // to be able to define the relative path from the full bundle path String fullImgPath = PathUtils.concatWebPath(originalCssPath, url); String imgUrl = PathUtils.getRelativeWebPath(PathUtils.getParentPath(newCssPath), fullImgPath); return imgUrl; }
/** * Normalizes a path and adds a separator at its start and its end. * * @param path * the path * @return the normalized path */ public static String asDirPath(String path) { return (URL_SEPARATOR + normalizePath(path) + URL_SEPARATOR); }
public Set<String> findResourcePaths(String location, URL resourceUrl) throws IOException { // Computes the physical root of the classpath to later // determine the resource path more easily String resourcePath = PathUtils.toFilePath(resourceUrl); String classpathPhysicalRoot = resourcePath.substring(0, resourcePath.length() - location.length()); // Gets the folder in which files will be scanned File folder = new File(resourcePath); return scanForResourcePathsInFileSystem(folder, classpathPhysicalRoot); }
String extractedName = PathUtils.extractLowerCasedName(bsu.getRelativePath()); bsu.setName(extractedName); LOG.trace("Name of the bundle extracted from its path: \"{}\"", extractedName);
String rootRelativePath = PathUtils.getRootRelativePath(originalPath); url = rootRelativePath + url.substring(contextPath.length()); Matcher urlMatcher = URL_PATTERN.matcher(finalUrl); if (urlMatcher.find()) { // Normalize only if a real URL finalUrl = PathUtils.normalizePath(finalUrl);
basePath = getParentPath(basePath); String fullPath = null; if (len == 0) { return doNormalizeIgnoreOtherSeparator(fullFilenameToAdd, true); return doNormalizeIgnoreOtherSeparator(fullPath, true);
String resultPath = buildRelativePath(newPath, oldPath, '/');
/** * <p> * Computes the final asset name: * <ol> * <li>First by reading the asset storage unit if the name if specified</li> * <li>Otherwise by extracting the asset name from its first location</li> * </ol> * </p> * * @param asu * The asset storage unit definition coming from the bundle * definition. * @param location * The selected location. * * @return the name of the asset. */ private String getName(AssetStorageUnit asu, String location) { if (StringUtils.isNotBlank(asu.getName())) { return asu.getName(); } else { return PathUtils.extractLowerCasedName(location); } }
String rootRelativePath = PathUtils.getRootRelativePath(originalPath); url = rootRelativePath + url.substring(contextPath.length()); Matcher urlMatcher = URL_PATTERN.matcher(finalUrl); if (urlMatcher.find()) { // Normalize only if a real URL finalUrl = PathUtils.normalizePath(finalUrl);
basePath = getParentPath(basePath); String fullPath = null; if (len == 0) { return doNormalizeIgnoreOtherSeparator(fullFilenameToAdd, true); return doNormalizeIgnoreOtherSeparator(fullPath, true);
String resultPath = buildRelativePath(newPath, oldPath, '/');
/** * Returns the rewritten image path * * @param originalCssPath * the original Css path * @param newCssPath * the new Css path * @param url * the image URL * @return the rewritten image path * @throws IOException * if an IOException occurs */ protected String getRewrittenImagePath(String originalCssPath, String newCssPath, String url) { // Here we generate the full path of the CSS image // to be able to define the relative path from the full bundle path String fullImgPath = PathUtils.concatWebPath(originalCssPath, url); String imgUrl = PathUtils.getRelativeWebPath(PathUtils.getParentPath(newCssPath), fullImgPath); return imgUrl; }
/** * <p> * Computes the final asset name: * <ol> * <li>First by reading the asset storage unit if the name if specified</li> * <li>Otherwise by extracting the asset name from its first location</li> * </ol> * </p> * * @param asu * The asset storage unit definition coming from the bundle * definition. * @param location * The selected location. * * @return the name of the asset. */ private String getName(AssetStorageUnit asu, String location) { if (StringUtils.isNotBlank(asu.getName())) { return asu.getName(); } else { return PathUtils.extractLowerCasedName(location); } }
/** * Normalizes a path and adds a separator at its start and its end. * * @param path * the path * @return the normalized path */ public static String asDirPath(String path) { return (URL_SEPARATOR + normalizePath(path) + URL_SEPARATOR); }
public Set<String> findResourcePaths(String location, URL resourceUrl) throws IOException { // Computes the physical root of the classpath to later // determine the resource path more easily String resourcePath = PathUtils.toFilePath(resourceUrl); String classpathPhysicalRoot = resourcePath.substring(0, resourcePath.length() - location.length()); // Gets the folder in which files will be scanned File folder = new File(resourcePath); return scanForResourcePathsInFileSystem(folder, classpathPhysicalRoot); }
String extractedName = PathUtils.extractLowerCasedName(bsu.getRelativePath()); bsu.setName(extractedName); LOG.trace("Name of the bundle extracted from its path: \"{}\"", extractedName);
/** * Normalizes a path and adds a separator at its start. * * @param path * @return */ public static String asPath(String path) { return (URL_SEPARATOR + normalizePath(path)); }
String filePath = PathUtils.toFilePath(resourceUrl);
String extractedName = PathUtils.extractLowerCasedName(bsu.getRelativePath()); bsu.setName(extractedName); LOG.trace("Name of the bundle extracted from its path: \"{}\"", extractedName); String extractedName = PathUtils.extractLowerCasedName(firstFoundLocation); asu.setName(extractedName); LOG.trace("Name of the asset extracted from its first location: \"{}\"", extractedName);
/** * Normalizes a path and adds a separator at its start. * * @param path * @return */ public static String asPath(String path) { return (URL_SEPARATOR + normalizePath(path)); }