comparison src/org/eclipse/jetty/server/handler/HandlerList.java @ 1000:32d4b569567c

simplify handle()
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 19 Oct 2016 04:22:51 -0600
parents 3428c60d7cfc
children
comparison
equal deleted inserted replaced
999:74b9daf2826c 1000:32d4b569567c
19 package org.eclipse.jetty.server.handler; 19 package org.eclipse.jetty.server.handler;
20 20
21 import java.io.IOException; 21 import java.io.IOException;
22 22
23 import javax.servlet.ServletException; 23 import javax.servlet.ServletException;
24 import javax.servlet.http.HttpServletRequest;
25 import javax.servlet.http.HttpServletResponse; 24 import javax.servlet.http.HttpServletResponse;
26 25
27 import org.eclipse.jetty.server.Handler; 26 import org.eclipse.jetty.server.Handler;
28 import org.eclipse.jetty.server.Request; 27 import org.eclipse.jetty.server.Request;
29 28
33 * each contained handler in turn until either an exception is thrown, the response 32 * each contained handler in turn until either an exception is thrown, the response
34 * is committed or a positive response status is set. 33 * is committed or a positive response status is set.
35 */ 34 */
36 public class HandlerList extends HandlerCollection 35 public class HandlerList extends HandlerCollection
37 { 36 {
38 /* ------------------------------------------------------------ */ 37 @Override
39 /** 38 public void handle(String target, Request request, HttpServletResponse response)
40 * @see Handler#handle(String, Request, HttpServletRequest, HttpServletResponse) 39 throws IOException, ServletException
41 */ 40 {
42 @Override 41 Handler[] handlers = getHandlers();
43 public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) 42
44 throws IOException, ServletException 43 if (handlers!=null && isStarted())
45 { 44 {
46 Handler[] handlers = getHandlers(); 45 for (int i=0;i<handlers.length;i++)
47 46 {
48 if (handlers!=null && isStarted()) 47 handlers[i].handle(target, request, response);
49 { 48 if ( request.isHandled())
50 for (int i=0;i<handlers.length;i++) 49 return;
51 { 50 }
52 handlers[i].handle(target,baseRequest, request, response); 51 }
53 if ( baseRequest.isHandled()) 52 }
54 return;
55 }
56 }
57 }
58 } 53 }