title: Sling: Find out if resource is an image
body: <p>I have a completely set-up CQ5/AEM application and am supposed to generate a sitemap.xml. So far, so good.</p>
  
  <p>I have a list of all the pages, but some of those pages are actually images. My question: How can I find out if a page is actually an image? Both have jcr:primaryType=cq:Page</p>
  
  <pre><code>public void getMoreChildren(HttpServletRequest request, JspWriter out, Page incomingChildPage) {
          Iterator&lt;Page&gt; childPageChildren = incomingChildPage.listChildren();
          while (childPageChildren.hasNext()) {
              Page childPage = childPageChildren.next();
              String pagePath = childPage.getPath();
              SlingHttpServletRequest slingRequest = (SlingHttpServletRequest)request;
  
              ResourceResolver resourceResolver = slingRequest.getResourceResolver();
              Externalizer externalizer = resourceResolver.adaptTo(Externalizer.class);
  
              String externalUrl = externalizer.publishLink(resourceResolver,pagePath) + ".html";
              //do things with data so far
              getMoreChildren(request, out, childPage);
          }
  }
  </code></pre>
  
  <p>All of this runs within a JSP and does what it's supposed to do so far, except that it treats images as pages and I want to ignore image files. What do I need to do?</p>