Package org.brixcms.web.nodepage

Examples of org.brixcms.web.nodepage.BrixPageParameters


      // 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;
          }
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;
            }
        }
        for (QueryParameter parameter : url.getQueryParameters()) {
          String parameterName = parameter.getName();
          if (PageComponentInfo.parse(parameterName) == null)
          {
              parameters.add(parameterName, parameter.getValue());
          }
        }
        return parameters;
    }
View Full Code Here

    private Url encode(BrixNodeWebPage page) {
        BrixNode node = page.getModelObject();
        // This is a URL for redirect. Allow components to contribute state to
        // URL if they want to
        final BrixPageParameters parameters = page.getBrixPageParameters();
        for (NamedPair namedPair : parameters.getAllNamed()) {
            if (isNumber(namedPair.getKey())) {
                parameters.remove(namedPair.getKey());
            }
        }
        page.visitChildren(PageParametersAware.class, new IVisitor<Component, PageParametersAware>() {
            @Override
            public void component(Component component, IVisit iVisit) {
View Full Code Here

                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;
                }
View Full Code Here

        if (copy.nodeModel != null)
            this.nodeModel = new BrixNodeModel(copy.nodeModel.getObject());
        this.url = copy.url;

        if (copy.parameters != null)
            this.parameters = new BrixPageParameters(copy.parameters);
    }
View Full Code Here

        this.nodeModel = nodeModel;
    }

    public BrixPageParameters getParameters() {
        if (parameters == null) {
            parameters = new BrixPageParameters();
        }
        return parameters;
    }
View Full Code Here

    }

    public IRequestHandler getRequestTarget() {
        final IModel<BrixNode> model = getNodeModel();
        return new BrixNodeRequestHandler(model != null ? model : new BrixNodeModel("invalidId",
                "invalidWorkspace"), parameters != null ? parameters : new BrixPageParameters()) {
            @Override
            public String getNodeURL() {
                if (getType() == Type.NODE) {
                    return model != null ? super.getNodeURL() : "";
                } else {
View Full Code Here

     *
     * @return url to the current brix page
     * @throws BrixException if the current request was not for a brix page
     */
    public static String urlForCurrentPage() {
        return urlForCurrentPage(new BrixPageParameters());
    }
View Full Code Here

public class PreviewNodeIFrame extends BrixGenericWebMarkupContainer<BrixNode> {
    private static final String PREVIEW_PARAM = Brix.NS_PREFIX + "preview";

    public static boolean isPreview() {
        BrixPageParameters params = BrixPageParameters.getCurrent();
        if (params != null) {
            if (params.get(PREVIEW_PARAM).toBoolean(false)) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

        super(id, model);
        setOutputMarkupId(true);
    }

    private CharSequence getUrl() {
        BrixPageParameters parameters = new BrixPageParameters();
        IModel<BrixNode> nodeModel = getModel();
        String workspace = nodeModel.getObject().getSession().getWorkspace().getName();
        parameters.set(BrixRequestCycleProcessor.WORKSPACE_PARAM, workspace);
        parameters.set(PREVIEW_PARAM, "true");
        StringBuilder url = new StringBuilder(getRequestCycle()
                .urlFor(new BrixNodeRequestHandler(nodeModel, parameters)));
        return url;
    }
View Full Code Here

TOP

Related Classes of org.brixcms.web.nodepage.BrixPageParameters

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.