title: How does Apache Sling script resolving rules work?
body: <p>I have page with name <code>tst</code> in content whose</p>
  
  <p><code>sling:resourceType = news-portal/pages/test</code></p>
  
  <p>page structure (under the <code>/apps</code>):</p>
  
  <p><img src="https://i.stack.imgur.com/axdfD.png" alt="enter image description here"></p>
  
  <p>test has </p>
  
  <p><code>sling:resourceSuperType = news-portal/pages/news-repo-main-page</code></p>
  
  <p>in browser I type following URL:</p>
  
  <pre><code>http://localhost:4502/cf#/content/tst.selector.pdf.html
  </code></pre>
  
  <p>after this request I see content of <code>selector.jsp</code></p>
  
  <p>But I expected to see content of <code>selector.pdf.jsp</code>  because it has more suitable much according my opinion.</p>
  
  <ol>
  <li><p>Can you explain how it works?</p></li>
  <li><p>Is there URL which can show content of <code>selector.pdf.jsp</code> ? </p></li>
  <li>Does the choice of content affects if test had  <code>sling:resourceType</code>
  instead of <code>sling:resourceSuperType</code> or together? (I try to test but
  don't see affection)</li>
  </ol>
  
  <p>P.S.</p>
  
  <p>I know that answer somewhere here:</p>
  
  <p><img src="https://i.stack.imgur.com/VfxJS.png" alt="enter image description here"></p>
  
  <p>But I have problems with understanding</p>
  
  <p><strong>P.S.</strong></p>
  
  <p>log resolving:</p>
  
  <pre><code>      0 (2014-03-28 13:18:31) TIMER_START{Request Processing}
        0 (2014-03-28 13:18:31) COMMENT timer_end format is {&lt;elapsed msec&gt;,&lt;timer name&gt;} &lt;optional message&gt;
        0 (2014-03-28 13:18:31) LOG Method=GET, PathInfo=/content/tst.selector.pdf.html
        0 (2014-03-28 13:18:31) TIMER_START{ResourceResolution}
        0 (2014-03-28 13:18:31) TIMER_END{0,ResourceResolution} URI=/content/tst.selector.pdf.html resolves to Resource=JcrNodeResource, type=cq:Page, superType=null, path=/content/tst
        0 (2014-03-28 13:18:31) LOG Resource Path Info: SlingRequestPathInfo: path='/content/tst', selectorString='selector.pdf', extension='html', suffix='null'
        0 (2014-03-28 13:18:31) TIMER_START{ServletResolution}
        0 (2014-03-28 13:18:31) TIMER_START{resolveServlet(JcrNodeResource, type=cq:Page, superType=null, path=/content/tst)}
        0 (2014-03-28 13:18:31) TIMER_END{0,resolveServlet(JcrNodeResource, type=cq:Page, superType=null, path=/content/tst)} Using servlet /libs/foundation/components/primary/cq/Page/Page.jsp
        0 (2014-03-28 13:18:31) TIMER_END{0,ServletResolution} URI=/content/tst.selector.pdf.html handled by Servlet=/libs/foundation/components/primary/cq/Page/Page.jsp
        0 (2014-03-28 13:18:31) LOG Applying Requestfilters
        0 (2014-03-28 13:18:31) LOG Calling filter: org.apache.sling.bgservlets.impl.BackgroundServletStarterFilter
        0 (2014-03-28 13:18:31) LOG Calling filter: org.apache.sling.rewriter.impl.RewriterFilter
        0 (2014-03-28 13:18:31) LOG Calling filter: com.day.cq.wcm.core.impl.WCMRequestFilter
        0 (2014-03-28 13:18:31) LOG Calling filter: org.apache.sling.i18n.impl.I18NFilter
        0 (2014-03-28 13:18:31) LOG Calling filter: com.day.cq.theme.impl.ThemeResolverFilter
        0 (2014-03-28 13:18:31) LOG Calling filter: com.day.cq.wcm.foundation.forms.impl.FormsHandlingServlet
        1 (2014-03-28 13:18:31) LOG Calling filter: org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter
        1 (2014-03-28 13:18:31) LOG Calling filter: com.day.cq.wcm.mobile.core.impl.redirect.RedirectFilter
        1 (2014-03-28 13:18:31) LOG RedirectFilter did not redirect (MobileUtil.isMobileResource() returns false)
        1 (2014-03-28 13:18:31) LOG Calling filter: com.day.cq.wcm.core.impl.warp.TimeWarpFilter
        1 (2014-03-28 13:18:31) LOG Applying Componentfilters
        1 (2014-03-28 13:18:31) LOG Calling filter: com.day.cq.wcm.core.impl.WCMComponentFilter
        1 (2014-03-28 13:18:31) LOG Calling filter: com.day.cq.wcm.core.impl.WCMDebugFilter
        1 (2014-03-28 13:18:31) TIMER_START{/libs/foundation/components/primary/cq/Page/Page.jsp#0}
        1 (2014-03-28 13:18:31) LOG Including resource JcrNodeResource, type=news-portal/pages/test, superType=null, path=/content/tst/jcr:content (SlingRequestPathInfo: path='/content/tst/jcr:content', selectorString='selector.pdf', extension='html', suffix='null')
        1 (2014-03-28 13:18:31) TIMER_START{resolveServlet(JcrNodeResource, type=news-portal/pages/test, superType=null, path=/content/tst/jcr:content)}
        1 (2014-03-28 13:18:31) TIMER_END{0,resolveServlet(JcrNodeResource, type=news-portal/pages/test, superType=null, path=/content/tst/jcr:content)} Using servlet /apps/news-portal/pages/news-repo-main-page/selector.jsp
        1 (2014-03-28 13:18:31) LOG Applying Includefilters
        1 (2014-03-28 13:18:31) LOG Calling filter: com.day.cq.wcm.core.impl.WCMComponentFilter
        1 (2014-03-28 13:18:31) LOG Calling filter: com.day.cq.wcm.core.impl.WCMDebugFilter
        1 (2014-03-28 13:18:31) TIMER_START{/apps/news-portal/pages/news-repo-main-page/selector.jsp#1}
        2 (2014-03-28 13:18:31) LOG Found processor for post processing ProcessorConfiguration: {contentTypes=[text/html],order=-1, active=true, valid=true, processErrorResponse=true, pipeline=(generator=Config(type=htmlparser, config={}), transformers=(Config(type=linkchecker, config={}), Config(type=mobile, config=org.apache.sling.jcr.resource.JcrPropertyMap@25c0b221), Config(type=mobiledebug, config=org.apache.sling.jcr.resource.JcrPropertyMap@deea7e4), Config(type=contentsync, config=org.apache.sling.jcr.resource.JcrPropertyMap@2f5070e1), serializer=Config(type=htmlwriter, config={}))}
        2 (2014-03-28 13:18:31) TIMER_END{1,/apps/news-portal/pages/news-repo-main-page/selector.jsp#1}
        2 (2014-03-28 13:18:31) TIMER_END{1,/libs/foundation/components/primary/cq/Page/Page.jsp#0}
        2 (2014-03-28 13:18:31) TIMER_END{2,Request Processing} Request Processing
  </code></pre>
  
  <h2>UPDATE</h2>
  
  <p>I noticed that if I create following structure and send request to </p>
  
  <pre><code>http://localhost:4502/cf#/content/tst.selector.pdf.html
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/xr8hW.png" alt="enter image description here"></p>
  
  <p>I see content of <code>pdf.jsp</code></p>