diff src/org/eclipse/jetty/server/handler/ResourceHandler.java @ 994:4e9d373bf6e9

remove ContextHandler.Context
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 18 Oct 2016 16:34:18 -0600
parents 0608a6664bee
children 7d28be82ab75
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/handler/ResourceHandler.java	Tue Oct 18 15:54:54 2016 -0600
+++ b/src/org/eclipse/jetty/server/handler/ResourceHandler.java	Tue Oct 18 16:34:18 2016 -0600
@@ -59,7 +59,6 @@
 {
 	private static final Logger LOG = LoggerFactory.getLogger(ResourceHandler.class);
 
-	ContextHandler _context;
 	Resource _baseResource;
 	Resource _defaultStylesheet;
 	Resource _stylesheet;
@@ -132,8 +131,6 @@
 	public void doStart()
 	throws Exception
 	{
-		_context = ContextHandler.getCurrentContext();
-
 		if (!_aliases && !FileResource.getCheckAliases())
 			throw new IllegalStateException("Alias checking disabled");
 
@@ -190,11 +187,7 @@
 		}
 	}
 	
-	/* ------------------------------------------------------------ */
-	/**
-	 * @return Returns the stylesheet as a Resource.
-	 */
-	public Resource getStylesheet()
+	private Resource getStylesheet()
 	{
 		if(_stylesheet != null)
 		{
@@ -259,7 +252,7 @@
 		_cacheControl=cacheControl==null?null:new ByteArrayBuffer(cacheControl);
 	}
 
-	private Resource getResource(String path) throws MalformedURLException
+	private Resource getResource(Request request,String path) throws MalformedURLException
 	{
 		if (path==null || !path.startsWith("/"))
 			throw new MalformedURLException(path);
@@ -267,9 +260,10 @@
 		Resource base = _baseResource;
 		if (base==null)
 		{
-			if (_context==null)
+			ContextHandler ch = request._contextHandler;
+			if (ch==null)
 				return null;
-			base = _context.getBaseResource();
+			base = ch.getBaseResource();
 			if (base==null)
 				return null;
 		}
@@ -287,7 +281,7 @@
 		return null;
 	}
 
-	private Resource getResource(HttpServletRequest request) throws MalformedURLException
+	private Resource getResource(Request request) throws MalformedURLException
 	{
 		String servletPath;
 		String pathInfo;
@@ -310,7 +304,7 @@
 		}
 		
 		String pathInContext = URIUtil.addPaths(servletPath,pathInfo);
-		return getResource(pathInContext);
+		return getResource(request,pathInContext);
 	}
 
 
@@ -361,7 +355,7 @@
 			skipContentBody = true;
 		}
 		
-		Resource resource = getResource(request);
+		Resource resource = getResource(baseRequest);
 		
 		if (resource==null || !resource.exists())
 		{