diff src/org/eclipse/jetty/server/handler/ResourceHandler.java @ 1000:32d4b569567c

simplify handle()
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 19 Oct 2016 04:22:51 -0600
parents 7d28be82ab75
children 6939226e0ac4
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/handler/ResourceHandler.java	Wed Oct 19 00:59:46 2016 -0600
+++ b/src/org/eclipse/jetty/server/handler/ResourceHandler.java	Wed Oct 19 04:22:51 2016 -0600
@@ -23,7 +23,6 @@
 import java.net.MalformedURLException;
 
 import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.eclipse.jetty.http.HttpFields;
@@ -308,13 +307,10 @@
 		return null;
 	}
 
-	/* ------------------------------------------------------------ */
-	/*
-	 * @see org.eclipse.jetty.server.Handler#handle(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, int)
-	 */
-	public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
+	@Override
+	public void handle(String target, Request request, HttpServletResponse response) throws IOException, ServletException
 	{
-		if (baseRequest.isHandled())
+		if (request.isHandled())
 			return;
 
 		boolean skipContentBody = false;
@@ -324,13 +320,13 @@
 			if(!HttpMethods.HEAD.equals(request.getMethod()))
 			{
 				//try another handler
-				super.handle(target, baseRequest, request, response);
+				super.handle(target, request, response);
 				return;
 			}
 			skipContentBody = true;
 		}
 		
-		Resource resource = getResource(baseRequest);
+		Resource resource = getResource(request);
 		
 		if (resource==null || !resource.exists())
 		{
@@ -344,7 +340,7 @@
 			else 
 			{
 				//no resource - try other handlers
-				super.handle(target, baseRequest, request, response);
+				super.handle(target, request, response);
 				return;
 			}
 		}
@@ -356,7 +352,7 @@
 		}
 
 		// We are going to serve something
-		baseRequest.setHandled(true);
+		request.setHandled(true);
 
 		if (resource.isDirectory())
 		{
@@ -372,7 +368,7 @@
 			else
 			{
 				doDirectory(request,response,resource);
-				baseRequest.setHandled(true);
+				request.setHandled(true);
 				return;
 			}
 		}
@@ -418,7 +414,7 @@
 	}
 
 	/* ------------------------------------------------------------ */
-	protected void doDirectory(HttpServletRequest request,HttpServletResponse response, Resource resource)
+	protected void doDirectory(Request request,HttpServletResponse response, Resource resource)
 		throws IOException
 	{
 		if (_directory)