Package ch.entwine.weblounge.common.impl.content.page

Examples of ch.entwine.weblounge.common.impl.content.page.PageURIImpl


      targetPage = (Page) getRequest().getAttribute(WebloungeRequest.PAGE);

      // If no page was specified, take homepage instead.
      if (targetPage == null) {
        ResourceURI homeURI = new PageURIImpl(site, "/");
        try {
          targetPage = (Page) contentRepository.get(homeURI);
          if (targetPage == null) {
            logger.warn("No page was found while processing composer on " + url);
            return;
          }
        } catch (SecurityException e) {
          logger.warn("Composer '" + id + "' was unable to choose homepage as fallback: " + e.getMessage());
          return;
        } catch (ContentRepositoryException e) {
          logger.warn("Composer '" + id + "' was unable to choose homepage as fallback: " + e.getMessage());
          return;
        }
      }

      if (contentProvider == null)
        contentProvider = targetPage;

      Pagelet[] content = contentProvider.getPagelets(id);
      Pagelet[] ghostContent = new Pagelet[0];

      // If composer is empty and ghost content is enabled, go up the page
      // hierarchy and try to find content for this composer
      Page contentPage = contentProvider;
      if (content.length == 0 && inheritFromParent) {
        String pageUrl = contentPage.getURI().getPath();
        while (ghostContent.length == 0 && pageUrl.length() > 1) {
          if (pageUrl.endsWith("/") && !"/".equals(pageUrl))
            pageUrl = pageUrl.substring(0, pageUrl.length() - 1);
          int urlSeparator = pageUrl.lastIndexOf("/");
          if (urlSeparator < 0) {
            contentPage = null;
            break;
          } else {
            pageUrl = pageUrl.substring(0, urlSeparator);
            if ("".equals(pageUrl))
              pageUrl = "/";
            ResourceURI pageURI = new PageURIImpl(site, pageUrl);
            try {
              contentPage = (Page) contentRepository.get(pageURI);
            } catch (SecurityException e) {
              logger.debug("Prevented loading of protected content from inherited page {} for composer {}", pageURI, id);
            }
View Full Code Here


      HTMLAction htmlAction = (HTMLAction)action;

      // Page URI
      if (htmlBlueprint.getPageURI() != null) {
        ResourceURI uri = htmlBlueprint.getPageURI();
        htmlAction.setPageURI(new PageURIImpl(uri.getSite(), uri.getPath()));
      }

      // Default page template
      htmlAction.setDefaultTemplate(htmlBlueprint.getDefaultTemplate());
    }
View Full Code Here

    Site site = getSite(request);
    if (site == null)
      throw new WebApplicationException(Status.NOT_FOUND);

    // Return the editor
    ResourceURI uri = new PageURIImpl(site, null, pageURI, Resource.WORK);
    PageletEditor editor;
    try {
      editor = workbench.getEditor(site, uri, composerId, pagelet, language, environment);
    } catch (IOException e) {
      throw new WebApplicationException(e);
View Full Code Here

    // Load the site
    Site site = getSite(request);
    if (site == null)
      throw new WebApplicationException(Status.NOT_FOUND);

    ResourceURI uri = new PageURIImpl(site, null, pageURI, Resource.WORK);
    String renderedPagelet;
    try {
      renderedPagelet = workbench.getRenderer(site, uri, composerId, pageletIndex, pageXml, language, environment);
    } catch (Exception e) {
      throw new WebApplicationException(e);
View Full Code Here

    // Load the site
    Site site = getSite(request);
    if (site == null)
      throw new WebApplicationException(Status.NOT_FOUND);

    ResourceURI uri = new PageURIImpl(site, null, pageURI, Resource.WORK);
    String renderedPagelet;
    try {
      renderedPagelet = workbench.getRenderer(site, uri, composerId, pageletIndex, language, environment);
    } catch (Exception e) {
      throw new WebApplicationException(e);
View Full Code Here

    // Create the page uri, either from the id or the path. If none is
    // specified, and we are not in jsp compilation mode, issue a warning
    ResourceURI uri = null;
    if (StringUtils.isNotBlank(pageId)) {
      uri = new PageURIImpl(site, null, pageId);
    } else if (StringUtils.isNotBlank(pagePath)) {
      uri = new PageURIImpl(site, pagePath, null);
    } else if (!request.getRequestURI().endsWith(".jsp")) {
      logger.warn("Neither uuid nor path were specified for image");
      return SKIP_BODY;
    } else {
      return SKIP_BODY;
View Full Code Here

    super.setSite(site);
    if (site == null)
      return;

    if (targetPath != null)
      this.pageURI = new PageURIImpl(site, targetPath);
    if (defaultTemplateId != null && defaultTemplate == null)
      setDefaultTemplate(site.getTemplate(defaultTemplateId));
  }
View Full Code Here

   *
   * @see ch.entwine.weblounge.common.site.Action#getPageURI()
   */
  public ResourceURI getPageURI() {
    if (pageURI == null && site != null && StringUtils.isNotBlank(targetPath)) {
      pageURI = new PageURIImpl(site, targetPath);
    }
    return pageURI;
  }
View Full Code Here

   *           if writing the contents to the output stream fails
   */
  protected Page aggregate(Message message, Site site) throws IOException,
  MessagingException, IllegalArgumentException {

    ResourceURI uri = new PageURIImpl(site, UUID.randomUUID().toString());
    Page page = new PageImpl(uri);
    Language language = site.getDefaultLanguage();

    // Extract title and subject. Without these two, creating a page is not
    // feasible, therefore both messages throw an IllegalArgumentException if
View Full Code Here

        logger.debug("Content repository is offline");
        response.invalidate();
        return SKIP_BODY;
      }

      ResourceURI pageURI = new PageURIImpl(site, null, pageId);

      try {
        page = (Page) contentRepository.get(pageURI);
        if (page == null) {
          logger.error("No data available for page {}", pageURI);
View Full Code Here

TOP

Related Classes of ch.entwine.weblounge.common.impl.content.page.PageURIImpl

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.