Package com.day.cq.commons

Examples of com.day.cq.commons.PathInfo


        }
        return paths;
    }

    private String decode(String url) {
        return new PathInfo(url).getResourcePath();
    }
View Full Code Here


        return false;
    }

    private String getVersionedPath(final String originalPath, final LibraryType libraryType) {
        try {
            final PathInfo pathInfo = new PathInfo(originalPath);

            final HtmlLibrary htmlLibrary = htmlLibraryManager.getLibrary(libraryType, pathInfo.getResourcePath());

            if (htmlLibrary != null) {
                StringBuilder builder = new StringBuilder();
                builder.append(htmlLibrary.getLibraryPath());
                builder.append(".");

                String selector = pathInfo.getSelectorString();
                if (selector != null) {
                    builder.append(selector).append(".");
                }
                builder.append(DigestUtils.md5Hex(htmlLibrary.getInputStream()));
                builder.append(libraryType.extension);

                return builder.toString();
            } else {
                log.debug("Could not find HtmlLibrary at path: {}", pathInfo.getResourcePath());
                return null;
            }
        } catch (Exception ex) {
            // Handle unexpected formats of the original path
            log.error("Attempting to get a versioned path for [ {} ] but could not because of: {}", originalPath,
View Full Code Here

            return parent;
        }

        final ResourceResolver resourceResolver = resource.getResourceResolver();
        final String path = resource.getPath();
        final PathInfo pathInfo = new PathInfo(path);
        String[] parts = StringUtils.split(pathInfo.getResourcePath(), '/');

        for (int i = parts.length - 1; i >= 0; i--) {
            String[] tmpArray = (String[]) ArrayUtils.subarray(parts, 0, i);
            String tmpStr = "/".concat(StringUtils.join(tmpArray, '/'));
View Full Code Here

            try {
                adminResourceResolver = resourceResolverFactory.getAdministrativeResourceResolver(null);
                final Resource resource = adminResourceResolver.resolve(this.errorImagePath);

                if (resource != null && resource.isResourceType(JcrConstants.NT_FILE)) {
                    final PathInfo pathInfo = new PathInfo(this.errorImagePath);

                    if (!StringUtils.equals("img", pathInfo.getSelectorString())
                            || StringUtils.isBlank(pathInfo.getExtension())) {

                        log.warn("Absolute Error Image Path paths to nt:files should have '.img.XXX' "
                                + "selector.extension");
                    }
                }
View Full Code Here

     * @param cropWidth crop rectangle width starting from cropX,cropY
     * @param cropHeight crop rectangle height starting from cropX,cropY
     * @return a well-formed absolute QuickImage URI
     */
    public static String getSrc(String path, int width, int height, int rotation, int cropX, int cropY, int cropWidth, int cropHeight) {
        final PathInfo pathInfo = new PathInfo(path);
        final String extension = pathInfo.getExtension();

        String src = path + ".img";

        if(StringUtils.isNotBlank(extension)) {
            src += "." + extension;
View Full Code Here

    private boolean accepts(Resource resource, HttpServletRequest request) {
        if(resource == null || request == null) {
            return false;
        }

        final RequestPathInfo pathInfo = new PathInfo(request.getRequestURI());
        final String suffix = getSuffix(request.getRequestURI());
        final String extension = pathInfo.getExtension();
        final String quick = parseSuffix(suffix, com.activecq.tools.quickimage.Constants.KEY_QUICK, 0, null);

        if(StringUtils.isBlank(extension) ||
                StringUtils.isBlank(suffix) ||
                !ResourceUtil.isA(resource, JcrConstants.NT_FILE) ||
View Full Code Here

TOP

Related Classes of com.day.cq.commons.PathInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.