View Javadoc

1   // ========================================================================
2   // Copyright (c) 2006-2009 Mort Bay Consulting Pty. Ltd.
3   // ------------------------------------------------------------------------
4   // All rights reserved. This program and the accompanying materials
5   // are made available under the terms of the Eclipse Public License v1.0
6   // and Apache License v2.0 which accompanies this distribution.
7   // The Eclipse Public License is available at 
8   // http://www.eclipse.org/legal/epl-v10.html
9   // The Apache License v2.0 is available at
10  // http://www.opensource.org/licenses/apache2.0.php
11  // You may elect to redistribute this code under either of these licenses. 
12  // ========================================================================
13  
14  package org.eclipse.jetty.server;
15  
16  import org.eclipse.jetty.util.component.LifeCycle;
17  
18  /**
19   * A Handler that contains other Handlers.
20   * <p>
21   * The contained handlers may be one (see @{link {@link org.eclipse.jetty.server.handler.HandlerWrapper})
22   * or many (see {@link org.eclipse.jetty.server.handler.HandlerList} or {@link org.eclipse.jetty.server.handler.HandlerCollection}. 
23   *
24   */
25  public interface HandlerContainer extends LifeCycle
26  {
27      /* ------------------------------------------------------------ */
28      /**
29       * @return array of handlers directly contained by this handler.
30       */
31      public Handler[] getHandlers();
32      
33      /* ------------------------------------------------------------ */
34      /**
35       * @return array of all handlers contained by this handler and it's children
36       */
37      public Handler[] getChildHandlers();
38      
39      /* ------------------------------------------------------------ */
40      /**
41       * @param byclass
42       * @return array of all handlers contained by this handler and it's children of the passed type.
43       */
44      public Handler[] getChildHandlersByClass(Class<?> byclass);
45      
46      /* ------------------------------------------------------------ */
47      /**
48       * @param byclass
49       * @return first handler of all handlers contained by this handler and it's children of the passed type.
50       */
51      public <T extends Handler> T getChildHandlerByClass(Class<T> byclass);
52  }