Package org.brixcms

Examples of org.brixcms.Path


        if (url.getSegments().get(0).equals("webdav") || url.getSegments().get(0).equals("jcrwebdav")) {
          return null;
        }
      }

      Path path = new Path("/" + url.getPath());

      // root path handling
      if (path.isRoot()) {
        if (handleHomePage) {
          final BrixNode node = getNodeForUriPath(path);
          return SitePlugin.get().getNodePluginForNode(node)
              .respond(new BrixNodeModel(node), new BrixPageParameters(request.getRequestParameters()));
        } else {
          return null;
        }
      }

      IRequestHandler handler = null;
      try {
        while (handler == null) {
          final BrixNode node = getNodeForUriPath(path);
          if (node != null) {
            SiteNodePlugin plugin = SitePlugin.get().getNodePluginForNode(node);
            if (plugin instanceof AbstractSitePagePlugin) {
              handler = SitePlugin.get().getNodePluginForNode(node)
                  .respond(new BrixNodeModel(node), createBrixPageParams(request.getUrl(), path));
            } else {
              handler = SitePlugin.get().getNodePluginForNode(node)
                  .respond(new BrixNodeModel(node), new BrixPageParameters(request.getRequestParameters()));
            }
          }
          if (handler != null || path.toString().equals(".")) {
            break;
          }
          path = path.parent();
          if (path.isRoot()) {
            break;
          }
        }
      } catch (JcrException e) {
        logger.warn("JcrException caught due to incorrect url", e);
View Full Code Here


        return handler;
    }

    private BrixPageParameters createBrixPageParams(Url url, Path path) {
        BrixPageParameters parameters = new BrixPageParameters();
        Path nodePath = path;
        Path requestPath = new Path("/" + url.getPath());

        if (nodePath.isAncestorOf(requestPath)) {
            Path remaining = new Path(requestPath.toString(), false).toRelative(nodePath);
            int i = 0;
            for (String s : remaining) {
                parameters.set(i, BrixNodePageUrlMapper.urlDecode(s));
                ++i;
            }
View Full Code Here

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

        builder.append(urlEncodePath(new Path(nodeURL, false)));

        boolean skipFirstSlash = builder.charAt(builder.length() - 1) == '/';

        for (int i = 0; i < parameters.getIndexedCount(); ++i) {
            if (!skipFirstSlash) {
View Full Code Here

     */
    public BrixNode getNodeForUriPath(final Path uriPath) {
        BrixNode node = null;

        // create desired nodepath
        final Path nodePath = brix.getConfig().getMapper().getNodePathForUriPath(uriPath.toAbsolute(), brix);

        if (nodePath != null) {
            // allow site plugin to translate the node path into an actual jcr
            // path
            final String jcrPath = SitePlugin.get().toRealWebNodePath(nodePath.toString());

            // retrieve jcr session
            final String workspace = getWorkspace();
            final JcrSession session = brix.getCurrentSession(workspace);

View Full Code Here

     * @return uri path that represents the node
     */
    public Path getUriPathForNode(final BrixNode node) {
        // allow site plugin to translate jcr path into node path
        final String jcrPath = SitePlugin.get().fromRealWebNodePath(node.getPath());
        final Path nodePath = new Path(jcrPath);

        // use urimapper to create the uri
        return brix.getConfig().getMapper().getUriPathForNode(nodePath, brix);
    }
View Full Code Here

        // TODO: This is just a quick fix
        if (pathStr.startsWith("/webdav") || pathStr.startsWith("/jcrwebdav")) {
            return null;
        }

        Path path = decode(new Path(pathStr, false));

        IRequestHandler target = null;
        try {
            while (target == null) {
                final BrixNode node = this.brixRequestCycleProcessor.getNodeForUriPath(path);
                if (node != null) {
                    target = getSwitchTarget(node);
                    if (target == null) {
                        target = SitePlugin.get().getNodePluginForNode(node).respond(
                                new BrixNodeModel(node), new BrixPageParameters(requestParameters));
                    }
                }
                if (path.isRoot() || path.toString().equals(".")) {
                    break;
                }
                path = path.parent();
            }
        } catch (JcrException e) {
            Throwable iter = e;
            while (iter.getCause() != null) {
                iter = iter.getCause();
View Full Code Here

            builder.append(BrixNodePageUrlMapper.urlDecode(s));
        }
        if (builder.length() == 0) {
            builder.append("/");
        }
        return new Path(builder.toString(), false);
    }
View Full Code Here

        String path = getRequest().getRequestParameters().getParameterValue("path").toString();
//        if (path == null) {
//            path = getRequestCycle().getPageParameters().getString("path");
//        }
        path = UrlDecoder.QUERY_INSTANCE.decode(path, getRequest().getCharset());
        onPathClicked(new Path(path));
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    public void validate(IValidatable validatable) {
        Object o = validatable.getValue();
        if (o != null) {
            JcrNode node = nodeModel.getObject();
            Path path = null;
            if (o instanceof Path) {
                path = (Path) o;
            } else {
                path = new Path(o.toString());
            }

            if (!path.isAbsolute()) {
                Path parent = new Path(node.getPath());
                if (!((BrixNode) node).isFolder())
                    parent = parent.parent();
                path = parent.append(path);
            } else {
                path = new Path(SitePlugin.get().toRealWebNodePath(path.toString()));
            }
            if (node.getSession().itemExists(path.toString()) == false) {
                ValidationError error = new ValidationError();
                error.setMessage("Node ${path} could not be found");
                error.addMessageKey("NodePathValidator");
View Full Code Here

        if (!requestPathString.startsWith("/"))
            requestPathString = "/" + requestPathString;

        BrixRequestCycleProcessor processor = (BrixRequestCycleProcessor) RequestCycle.get()
                .getActiveRequestHandler();
        Path nodePath = processor.getUriPathForNode(nodeModel.getObject());
        Path requestPath = new Path(requestPathString, false);

        if (nodePath.isAncestorOf(requestPath)) {
            Path remaining = new Path(requestPathString, false).toRelative(nodePath);
            int i = 0;
            for (String s : remaining) {
                parameters.set(i, urlDecode(s));
                ++i;
            }
View Full Code Here

TOP

Related Classes of org.brixcms.Path

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.