Examples of WebResourcePath


Examples of org.wso2.carbon.registry.common.WebResourcePath

        List <WebResourcePath> navigatablePaths = new ArrayList<WebResourcePath>();

        if (rawPath.equals(RegistryConstants.ROOT_PATH)) {

            WebResourcePath webPath = new WebResourcePath();
            webPath.setNavigateName("/");
            webPath.setNavigatePath("#");

            navigatablePaths.add(webPath);

        } else {

            // first add the root path
            WebResourcePath rootPath = new WebResourcePath();
            rootPath.setNavigateName("/");
            rootPath.setNavigatePath(RegistryConstants.ROOT_PATH);
            navigatablePaths.add(rootPath);

            String preparedPath = rawPath;
            if (preparedPath.startsWith(RegistryConstants.PATH_SEPARATOR)) {
                preparedPath = preparedPath.substring(RegistryConstants.PATH_SEPARATOR.length());
            }

            if (preparedPath.endsWith(RegistryConstants.PATH_SEPARATOR)) {
                preparedPath = preparedPath.
                        substring(0, preparedPath.length() - RegistryConstants.PATH_SEPARATOR.length());
            }

            String[] parts = preparedPath.split(RegistryConstants.PATH_SEPARATOR);
            for (int i = 0; i < parts.length; i++) {
                WebResourcePath resourcePath = new WebResourcePath();

                if (i == parts.length - 1) {
                    String[] q = parts[i].split(RegistryConstants.URL_SEPARATOR);
                    if (q.length == 2) {
                        if (q[1].startsWith("version:")) {
                            String versionNumber = q[1].substring("version:".length());
                            String navName = q[0] + " (version " + versionNumber + ")";
                            resourcePath.setNavigateName(navName);
                        } else {
                            resourcePath.setNavigateName(parts[i]);
                        }
                    } else {
                        resourcePath.setNavigateName(parts[i]);
                    }
                } else {
                    resourcePath.setNavigateName(parts[i]);
                }

                StringBuffer tempPath = new StringBuffer();
                for (int j = 0; j < i + 1; j++) {
                    tempPath.append(RegistryConstants.PATH_SEPARATOR).append(parts[j]);
                }
                resourcePath.setNavigatePath(tempPath.toString());
                navigatablePaths.add(resourcePath);
            }
        }

        return navigatablePaths.toArray(new WebResourcePath[navigatablePaths.size()]);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.