From 18497f6475dc8fba4f819209f3ca557c4ef1454b Mon Sep 17 00:00:00 2001 From: reger Date: Sun, 15 Dec 2013 23:39:19 +0100 Subject: [PATCH] remove unused init parameter from DefaultServlet - remove "RelativeResourceBase" parameter --- source/net/yacy/http/YaCyDefaultServlet.java | 28 ++++++-------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/source/net/yacy/http/YaCyDefaultServlet.java b/source/net/yacy/http/YaCyDefaultServlet.java index d1b45034c..c3d59ad48 100644 --- a/source/net/yacy/http/YaCyDefaultServlet.java +++ b/source/net/yacy/http/YaCyDefaultServlet.java @@ -105,11 +105,6 @@ import org.eclipse.jetty.util.resource.Resource; * * resourceBase Set to replace the context resource base * - * relativeResourceBase - * Set with a pathname relative to the base of the - * servlet context root. Useful for only serving static content out - * of only specific subdirectories. - * * pathInfoOnly If true, only the path info will be applied to the resourceBase * * @@ -124,7 +119,6 @@ public class YaCyDefaultServlet extends HttpServlet { protected Resource _resourceBase; protected MimeTypes _mimeTypes; protected String[] _welcomes; - protected String _relativeResourceBase; protected File _htLocalePath; protected File _htDocsPath; @@ -154,21 +148,19 @@ public class YaCyDefaultServlet extends HttpServlet { _pathInfoOnly = getInitBoolean("pathInfoOnly", _pathInfoOnly); Resource.setDefaultUseCaches(false); // caching is handled internally (prevent double caching) - _relativeResourceBase = getInitParameter("relativeResourceBase"); String rb = getInitParameter("resourceBase"); - if (rb != null) { - if (_relativeResourceBase != null) { - throw new UnavailableException("resourceBase & relativeResourceBase given, only one allowed"); - } - try { + try { + if (rb != null) { _resourceBase = Resource.newResource(rb); - } catch (IOException e) { - ConcurrentLog.logException(e); - throw new UnavailableException(e.toString()); + } else { + _resourceBase = Resource.newResource(Switchboard.getSwitchboard().getConfig("htRootPath", "htroot")); //default } + } catch (IOException e) { + ConcurrentLog.severe("FILEHANDLER", "YaCyDefaultServlet: resource base (htRootPath) missing"); + ConcurrentLog.logException(e); + throw new UnavailableException(e.toString()); } - if (ConcurrentLog.isFine("FILEHANDLER")) { ConcurrentLog.fine("FILEHANDLER","YaCyDefaultServlet: resource base = " + _resourceBase); } @@ -200,10 +192,6 @@ public class YaCyDefaultServlet extends HttpServlet { */ public Resource getResource(String pathInContext) { Resource r = null; - if (_relativeResourceBase != null) { - pathInContext = URIUtil.addPaths(_relativeResourceBase, pathInContext); - } - try { if (_resourceBase != null) { r = _resourceBase.addPath(pathInContext);