Package ch.entwine.weblounge.common.content

Examples of ch.entwine.weblounge.common.content.ResourceURI


      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 htmlBlueprint = (HTMLAction)blueprint;
      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

    // 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

      return SKIP_BODY;
    }

    // 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")) {
View Full Code Here

      throw new JspException();
    }

    // Create the resource 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(resourceId)) {
      uri = new GeneralResourceURIImpl(site, null, resourceId);
    } else if (StringUtils.isNotBlank(resourcePath)) {
      uri = new GeneralResourceURIImpl(site, resourcePath);
    } else {
View Full Code Here

    } catch (ContentRepositoryException e) {
      logger.warn("Error searching for image with given subjects.");
      return SKIP_BODY;
    }

    ResourceURI uri = null;
    ImageResource image = null;
    ImageContent imageContent = null;
    String linkToImage = null;
    PrintWriter writer = null;
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

   * @see java.lang.Object#equals(java.lang.Object)
   */
  @Override
  public boolean equals(Object obj) {
    if (obj instanceof ResourceURI) {
      ResourceURI uri = (ResourceURI) obj;
      if (id == null) {
        if (path != null && !pathEquals(uri))
          return false;
      } else if (uri.getIdentifier() == null) {
        if (path != null && !pathEquals(uri))
          return false;
      } else if (!id.equals(uri.getIdentifier()))
        return false;
      if (!pathEquals(uri))
        return false;
      if (version != uri.getVersion())
        return false;
      if (!site.equals(uri.getSite()))
        return false;
      if (type == null && uri.getType() != null)
        return false;
      if (type != null && !type.equals(uri.getType()))
        return false;
      return true;
    }
    return super.equals(obj);
  }
View Full Code Here

TOP

Related Classes of ch.entwine.weblounge.common.content.ResourceURI

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.