Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
correct DefaultServlet resource pathinContext calculation exclude servletPath option as resources are always relative to htroot or htdocs, the change reflects this. Theoretically it and the recent adjustments arcording relative urls allows to configure the instance to be configurable in a path other as root (/)
reger0959038624bc
diff --git a/source/net/yacy/http/servlets/YaCyDefaultServlet.java b/source/net/yacy/http/servlets/YaCyDefaultServlet.javaindex 0028b5dbd..b06b05db2 100644--- a/source/net/yacy/http/servlets/YaCyDefaultServlet.java+++ b/source/net/yacy/http/servlets/YaCyDefaultServlet.java@@ -129,8 +129,6 @@ import com.google.common.util.concurrent.UncheckedTimeoutException;** resourceBase Set to replace the context resource base*- * pathInfoOnly If true, only the path info will be applied to the resourceBase- ** </PRE>*/public class YaCyDefaultServlet extends HttpServlet {@@ -139,7 +137,6 @@ public class YaCyDefaultServlet extends HttpServlet {protected ServletContext _servletContext;protected boolean _acceptRanges = true;protected boolean _dirAllowed = true;- protected boolean _pathInfoOnly = false;protected Resource _resourceBase;protected MimeTypes _mimeTypes;protected String[] _welcomes;@@ -172,7 +169,6 @@ public class YaCyDefaultServlet extends HttpServlet {}_acceptRanges = getInitBoolean("acceptRanges", _acceptRanges);_dirAllowed = getInitBoolean("dirAllowed", _dirAllowed);- _pathInfoOnly = getInitBoolean("pathInfoOnly", _pathInfoOnly);Resource.setDefaultUseCaches(false); // caching is handled internally (prevent double caching)@@ -245,19 +241,15 @@ public class YaCyDefaultServlet extends HttpServlet {@Overrideprotected void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {- String servletPath;String pathInfo;Enumeration<String> reqRanges = null;boolean included = request.getAttribute(RequestDispatcher.INCLUDE_REQUEST_URI) != null;if (included) {- servletPath = (String) request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH);pathInfo = (String) request.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO);- if (servletPath == null) {- servletPath = request.getServletPath();+ if (pathInfo == null) {pathInfo = request.getPathInfo();}} else {- servletPath = _pathInfoOnly ? "/" : request.getServletPath();pathInfo = request.getPathInfo();// Is this a Range request?@@ -267,8 +259,8 @@ public class YaCyDefaultServlet extends HttpServlet {}}- String pathInContext = URIUtil.addPaths(servletPath, pathInfo);- boolean endsWithSlash = (pathInfo == null ? request.getServletPath() : pathInfo).endsWith(URIUtil.SLASH);+ String pathInContext = pathInfo == null ? "/" : pathInfo; // this is the path of the resource in _resourceBase (= path within htroot respective htDocs)+ boolean endsWithSlash = pathInContext.endsWith(URIUtil.SLASH);// Find the resourceResource resource = null;