2 // ========================================================================
3 // Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
4 // ------------------------------------------------------------------------
5 // All rights reserved. This program and the accompanying materials
6 // are made available under the terms of the Eclipse Public License v1.0
7 // and Apache License v2.0 which accompanies this distribution.
9 // The Eclipse Public License is available at
10 // http://www.eclipse.org/legal/epl-v10.html
12 // The Apache License v2.0 is available at
13 // http://www.opensource.org/licenses/apache2.0.php
15 // You may elect to redistribute this code under either of these licenses.
16 // ========================================================================
19 package org.eclipse.jetty.server.handler;
21 import java.io.IOException;
23 import javax.servlet.ServletException;
24 import javax.servlet.http.HttpServletRequest;
25 import javax.servlet.http.HttpServletResponse;
27 import org.eclipse.jetty.server.Handler;
28 import org.eclipse.jetty.server.Request;
30 /* ------------------------------------------------------------ */
32 * This extension of {@link HandlerCollection} will call
33 * each contained handler in turn until either an exception is thrown, the response
34 * is committed or a positive response status is set.
36 public class HandlerList extends HandlerCollection
38 /* ------------------------------------------------------------ */
40 * @see Handler#handle(String, Request, HttpServletRequest, HttpServletResponse)
43 public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
44 throws IOException, ServletException
46 Handler[] handlers = getHandlers();
48 if (handlers!=null && isStarted())
50 for (int i=0;i<handlers.length;i++)
52 handlers[i].handle(target,baseRequest, request, response);
53 if ( baseRequest.isHandled())