/**
   * Returns the relative path to the document directory in the request environment. If the document
   * or one of it's parent sections aren't found in the request environment, null is returned. The
   * path is relative to the request URL and may be empty if the request environment points to the
   * document. Otherwise the path ends with an "/" character.
   *
   * @param content the content document
   * @return the relative path to the document directory, or null if not in the request environment
   */
  private String getDocEnvPath(Content content) {
    RequestEnvironment env = context.getRequest().getEnvironment();
    ContentSection section = env.getSection();
    ContentDocument doc = env.getDocument();
    String path = "";

    if (doc != null) {
      if (doc.getId() == content.getId()) {
        return "";
      }
    } else if (section != null) {
      while (content != null) {
        if (section.getId() == content.getId()) {
          return path;
        }
        path = content.getName() + "/" + path;
        try {
          content = content.getParent();
        } catch (ContentException e) {
          LOG.error(e.getMessage());
          return null;
        }
      }
    }
    return null;
  }
 /**
  * Creates a new section template bean based upon the request environment section.
  *
  * @param context the bean context
  */
 SectionBean(BeanContext context) {
   this(context, context.getRequest().getEnvironment().getSection());
 }