title: Using PageManager API in AEM6/CQ5
body: <p>My requirement is to iterate over 8000 nodes in the JCR and create a Page object in Java for each node using PageManager API.</p>
  
  <p>To start with I am using PageManager to get the title of a Page as below.</p>
  
  <pre><code>public String currentPageTitle(String pagePath) {
      Page page=null;
      ResourceResolver resourceResolver=null;
      PageManager pageManager=null;
      try {
          if (pagePath != null) {
              resourceResolver = resourceResolverFactory.getAdministrativeResourceResolver(null);
              pageManager = resourceResolver.adaptTo(PageManager.class);
              **page = pageManager.getContainingPage(resourceResolver.getResource(pagePath));**
              LOGGER.error("Page $$$$"+page);
              if (page == null) {
                  throw new IllegalArgumentException("Page does not exist: " + pagePath);
              }
          }
      } catch (LoginException e) {
          LOGGER.error("Login Exception");
          e.printStackTrace();
      }
      return page.getTitle();
  }
  </code></pre>
  
  <p>Here I am getting page object as null, and it's throwing "Page does not exist: /content/geometrixx/fr.html" when i am trying to pass Geometrixx page URL to get its title.</p>