diff --git a/defaults/yacy.init b/defaults/yacy.init index d4b73c9d8..3266ffff8 100644 --- a/defaults/yacy.init +++ b/defaults/yacy.init @@ -76,6 +76,7 @@ server.https=false # if the used missed configuration steps that should be done, then a help system # is possible which leads the used based on the list of servlets that had been used # the list distinguishes called and submitted servlets +server.servlets.called = server.servlets.submitted = # server tracking: maximum time a track entry is hold in the internal cache @@ -1208,7 +1209,6 @@ interaction.autocrawler.categoryfilter = .* browser.autoload = false browser.load4everyone = false - # greedy learning: fast information acquisition heuristic for new peers # to make greedy learning work, it must be enabled in the network definition # the user may switch it off at any time, but if the automatic learning limit is reached @@ -1218,3 +1218,7 @@ browser.load4everyone = false # with some heuristics like: loading linked documents and adding a twitter search. # When the learning mode is finished, the user may switch on individual heuristics by himself. greedylearning.active = true + +# postprocessing parametrization +postprocessing.clickdepth.maxtime = 100 +postprocessing.clickdepth.maxdepth = 6 \ No newline at end of file diff --git a/htroot/Status.java b/htroot/Status.java index e0292d096..8874a240f 100644 --- a/htroot/Status.java +++ b/htroot/Status.java @@ -62,9 +62,7 @@ public class Status // check if the basic configuration was accessed before and forward prop.put("forwardToConfigBasic", 0); - if ( (post == null || !post.containsKey("noforward")) - && sb.getConfig("server.servlets.submitted", "").indexOf("ConfigBasic.html", 0) < 0 - && Seed.isDefaultPeerName(sb.peers.mySeed().getName()) ) { + if ((post == null || !post.containsKey("noforward")) && sb.getConfig("server.servlets.called", "").indexOf("ConfigBasic.html", 0) < 0) { // forward to ConfigBasic prop.put("forwardToConfigBasic", 1); } diff --git a/htroot/env/templates/header.template b/htroot/env/templates/header.template index 3901e445a..1b4f18171 100644 --- a/htroot/env/templates/header.template +++ b/htroot/env/templates/header.template @@ -75,21 +75,20 @@ - + #(navigation-advanced)#:: - + #(/navigation-advanced)#
diff --git a/source/net/yacy/http/servlets/YaCyDefaultServlet.java b/source/net/yacy/http/servlets/YaCyDefaultServlet.java index 467ddbe94..9623b2888 100644 --- a/source/net/yacy/http/servlets/YaCyDefaultServlet.java +++ b/source/net/yacy/http/servlets/YaCyDefaultServlet.java @@ -137,8 +137,9 @@ public class YaCyDefaultServlet extends HttpServlet { /* ------------------------------------------------------------ */ @Override public void init() throws UnavailableException { - _htDocsPath = Switchboard.getSwitchboard().htDocsPath; - _htLocalePath = Switchboard.getSwitchboard().getDataPath("locale.translated_html", "DATA/LOCALE/htroot"); + Switchboard sb = Switchboard.getSwitchboard(); + _htDocsPath = sb.htDocsPath; + _htLocalePath = sb.getDataPath("locale.translated_html", "DATA/LOCALE/htroot"); _servletContext = getServletContext(); @@ -160,7 +161,7 @@ public class YaCyDefaultServlet extends HttpServlet { if (rb != null) { _resourceBase = Resource.newResource(rb); } else { - _resourceBase = Resource.newResource(Switchboard.getSwitchboard().getConfig(SwitchboardConstants.HTROOT_PATH, SwitchboardConstants.HTROOT_PATH_DEFAULT)); //default + _resourceBase = Resource.newResource(sb.getConfig(SwitchboardConstants.HTROOT_PATH, SwitchboardConstants.HTROOT_PATH_DEFAULT)); //default } } catch (IOException e) { ConcurrentLog.severe("FILEHANDLER", "YaCyDefaultServlet: resource base (htRootPath) missing"); @@ -601,9 +602,7 @@ public class YaCyDefaultServlet extends HttpServlet { } } - if (in != null) { - in.close(); - } + if (in != null) in.close(); multi.close(); } } @@ -646,7 +645,7 @@ public class YaCyDefaultServlet extends HttpServlet { legacyRequestHeader.put(HeaderFramework.CONNECTION_PROP_CLIENTIP, request.getRemoteAddr()); legacyRequestHeader.put(HeaderFramework.CONNECTION_PROP_PATH, target); legacyRequestHeader.put(HeaderFramework.CONNECTION_PROP_EXT, targetExt); - + Switchboard sb = Switchboard.getSwitchboard(); if (legacyRequestHeader.containsKey(RequestHeader.AUTHORIZATION)) { if (HttpServletRequest.BASIC_AUTH.equalsIgnoreCase(request.getAuthType())) { } else { @@ -654,14 +653,14 @@ public class YaCyDefaultServlet extends HttpServlet { if (request.getUserPrincipal() != null) { String userpassEncoded = request.getHeader(RequestHeader.AUTHORIZATION); // e.g. "Basic AdminMD5hash" if (userpassEncoded != null) { - if (request.isUserInRole(AccessRight.ADMIN_RIGHT.toString()) && !Switchboard.getSwitchboard().getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5,"").isEmpty()) { + if (request.isUserInRole(AccessRight.ADMIN_RIGHT.toString()) && !sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5,"").isEmpty()) { // fake admin authentication for legacyRequestHeader (as e.g. DIGEST is not supported by legacyRequestHeader) legacyRequestHeader.put(RequestHeader.AUTHORIZATION, HttpServletRequest.BASIC_AUTH + " " - + Switchboard.getSwitchboard().getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, "")); + + sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, "")); } else { // fake Basic auth header for Digest auth (Basic username:md5pwdhash) String username = request.getRemoteUser(); - Entry user = Switchboard.getSwitchboard().userDB.getEntry(username); + Entry user = sb.userDB.getEntry(username); if (user != null) { legacyRequestHeader.put(RequestHeader.AUTHORIZATION, HttpServletRequest.BASIC_AUTH + " " + username + ":" + user.getMD5EncodedUserPwd()); @@ -756,7 +755,7 @@ public class YaCyDefaultServlet extends HttpServlet { HttpServletResponse response) throws IOException, ServletException { Switchboard sb = Switchboard.getSwitchboard(); - String localeSelection = Switchboard.getSwitchboard().getConfig("locale.language", "default"); + String localeSelection = sb.getConfig("locale.language", "default"); File targetFile = getLocalizedFile(target, localeSelection); File targetClass = rewriteClassFile(_resourceBase.addPath(target).getFile()); String targetExt = target.substring(target.lastIndexOf('.') + 1); @@ -876,21 +875,27 @@ public class YaCyDefaultServlet extends HttpServlet { response.setStatus(HttpServletResponse.SC_FOUND); return; } - - // add the application version, the uptime and the client name to every rewrite table - templatePatterns.put(servletProperties.PEER_STAT_VERSION, yacyBuildProperties.getVersion()); - templatePatterns.put(servletProperties.PEER_STAT_UPTIME, ((System.currentTimeMillis() - serverCore.startupTime) / 1000) / 60); // uptime in minutes - templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTNAME, sb.peers.mySeed().getName()); - templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTID, sb.peers.myID()); - templatePatterns.put(servletProperties.PEER_STAT_MYTIME, GenericFormatter.SHORT_SECOND_FORMATTER.format()); - Seed myPeer = sb.peers.mySeed(); - templatePatterns.put("newpeer", myPeer.getAge() >= 1 ? 0 : 1); - templatePatterns.putHTML("newpeer_peerhash", myPeer.hash); - templatePatterns.put("p2p", sb.getConfigBool(SwitchboardConstants.DHT_ENABLED, true) || !sb.isRobinsonMode() ? 1 : 0); - templatePatterns.put(SwitchboardConstants.GREETING_HOMEPAGE, sb.getConfig(SwitchboardConstants.GREETING_HOMEPAGE, "")); - templatePatterns.put(SwitchboardConstants.GREETING_SMALL_IMAGE, sb.getConfig(SwitchboardConstants.GREETING_SMALL_IMAGE, "")); - + if (targetFile.exists() && targetFile.isFile() && targetFile.canRead()) { + + sb.setConfig("server.servlets.called", appendPath(sb.getConfig("server.servlets.called", ""), target)); + if (args != null && args.size() > 0) sb.setConfig("server.servlets.submitted", appendPath(sb.getConfig("server.servlets.submitted", ""), target)); + + // add the application version, the uptime and the client name to every rewrite table + templatePatterns.put(servletProperties.PEER_STAT_VERSION, yacyBuildProperties.getVersion()); + templatePatterns.put(servletProperties.PEER_STAT_UPTIME, ((System.currentTimeMillis() - serverCore.startupTime) / 1000) / 60); // uptime in minutes + templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTNAME, sb.peers.mySeed().getName()); + templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTID, sb.peers.myID()); + templatePatterns.put(servletProperties.PEER_STAT_MYTIME, GenericFormatter.SHORT_SECOND_FORMATTER.format()); + Seed myPeer = sb.peers.mySeed(); + templatePatterns.put("newpeer", myPeer.getAge() >= 1 ? 0 : 1); + templatePatterns.putHTML("newpeer_peerhash", myPeer.hash); + templatePatterns.put("navigation-p2p", sb.getConfigBool(SwitchboardConstants.DHT_ENABLED, true) || !sb.isRobinsonMode() ? 1 : 0); + templatePatterns.put("navigation-crawlmonitor", sb.getConfig("server.servlets.submitted", "").indexOf("Crawler_p") >= 0); + templatePatterns.put("navigation-advanced", sb.getConfig("server.servlets.submitted", "").indexOf("Config") >= 0 || sb.getConfig("server.servlets.called", "").indexOf("CrawlStart") >= 0); + templatePatterns.put(SwitchboardConstants.GREETING_HOMEPAGE, sb.getConfig(SwitchboardConstants.GREETING_HOMEPAGE, "")); + templatePatterns.put(SwitchboardConstants.GREETING_SMALL_IMAGE, sb.getConfig(SwitchboardConstants.GREETING_SMALL_IMAGE, "")); + String mimeType = Classification.ext2mime(targetExt, MimeTypes.TEXT_HTML); InputStream fis; @@ -915,7 +920,13 @@ public class YaCyDefaultServlet extends HttpServlet { } } } - + + private static final String appendPath(String proplist, String path) { + if (proplist.length() == 0) return path; + if (proplist.indexOf(path) >= 0) return proplist; + return proplist + "," + path; + } + /** * parse SSI line and include resource () */