title: Multiple selectors using Sling Servlets
body: <p>Short version: How do I force the most matching on a servlet based on multiple selectors using Felix annotations for sling servlets?</p>
  
  <p>I have a few servlets defined in an OSGI bundle. I'm using the org.apache.felix.scr.annotations.sling.SlingServlet annotations.  </p>
  
  <pre><code>@SlingServlet(
     methods={GET},
     selectors {"v1"}
     ...
  )
  public class MyServlet extends SlingAllMethodsServlet {}
  
  ...
  
  @SlingServlet(
     methods={GET},
     selectors {"v1","special"}
     ...
  )
  public class MySpecialServlet extends MyServlet {}
  </code></pre>
  
  <p>My problem is that I can not find a way to force MySpecialServlet to only handle requests when both selectors are present. </p>
  
  <pre><code>GET http://localhost/my/resource.v1.special.json
  </code></pre>
  
  <p>Sometimes it will handle requests for only the v1 selector.</p>
  
  <pre><code>GET http://localhost/my/resource.v1.json
  </code></pre>
  
  <p>It seems that after using posting a new jar through the felix webconsole, if I request the double selector resource.v1.special.json before any other resource, then MySpecialServlet will also continue to handle v1 only requests.</p>
  
  <p>Is there a way I can force the more general servlet to handle the more general list of selectors using the current annotations? Am I missing some part annotation? I believe that this system might be using an older annotation. Perhaps it is worth migrating? I'm trying not to be too intrusive for this small task that I've been asked to do.</p>
  
  <p>Bear with me if I've conflated parts of these technologies. I've just walked up to this problem and I'm still sorting it out. Please correct any misalignment of terms.</p>