title: Jetty: How to nest HandlerWrapper, HandlerList, and ContextHandlerCollection, and ContextHandler
body: <p>I'm trying to build an api server on Jetty.</p>
  
  <p>I want to have multiple apis on routes that look like /apis/api1/endpoint, /apis/api2/endpoint, /apis/api3/endpoint, etc</p>
  
  <p>Essentially I have a HandlerWrapper, that contains a HandlerList of ContextHandlerCollections that in essence just does:</p>
  
  <pre><code>public void handle(...) {
      if (uri.startsWith("/apis/")) {
          log.info("This is an api request");
          this.getHandlerList.handle(...)
      } else {
          super.handle()
      }
  }
  
  private HandlerList getHandlerList() {
      HandlerList handlerList = new HandlerList();
      ContextHandlerCollection contextHandlerCollection = new ContextHandlerCollection();
      ContextHandler api1 = new ContextHandler("/apis/api1/endpoint");
      api1.setHandler(new Api1Handler());
      contextHandlerCollection.addHandler(api1);
      handlerList.addHandler(contextHandlerCollection);
      return handlerList
  }
  </code></pre>
  
  <p>Now when I try to do:</p>
  
  <pre><code>curl localhost:port/apis/api1/endpoint
  </code></pre>
  
  <p>I get a 404 not found but I see in the logs the statement "This is an api request".</p>
  
  <p>Any hints?</p>
  
  <p>I basically want one ContextHandlerCollection for each api1, api2 etc. And the ContextHandlerCollection should be composed of a set of endpoint-specific handlers to choose from.</p>
  
  <p>What am I missing?</p>
  
  <p>Cheers,</p>