code: private CmsResource getContainerpage(CmsObject cms) throws CmsException {
  
          String currentUri = cms.getRequestContext().getUri();
          CmsResource containerPage = cms.readResource(currentUri);
          if (!CmsResourceTypeXmlContainerPage.isContainerPage(containerPage)) {
              // container page is used as template
              String cntPagePath = cms.readPropertyObject(
                  containerPage,
                  CmsPropertyDefinition.PROPERTY_TEMPLATE_ELEMENTS,
                  true).getValue("");
              try {
                  containerPage = cms.readResource(cntPagePath);
              } catch (CmsException e) {
                  if (!LOG.isDebugEnabled()) {
                      LOG.warn(e.getLocalizedMessage());
                  }
                  LOG.debug(e.getLocalizedMessage(), e);
              }
          }
          return containerPage;
      }
docs: Returns the requested container-page resource.<p>
  
  @param cms the current cms object
  
  @return the container-page resource
  
  @throws CmsException if the resource could not be read for any reason