Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
Network Access servlet : render pure relative HTML links.
lucciomanf72c99474e5c
diff --git a/htroot/AccessTracker_p.html b/htroot/AccessTracker_p.htmlindex 75a59983b..0a1089262 100644--- a/htroot/AccessTracker_p.html+++ b/htroot/AccessTracker_p.html@@ -59,7 +59,7 @@<tr class="TableCell#(dark)#Light::Dark#(/dark)#"><td><a href="AccessTracker_p.html?page=1&host=#[host]#">#[host]#</a></td><td>#[date]#</td>- <td><a href="#[path]#">#[path]#</a></td>+ <td><a href="#[relativePath]#">#[path]#</a></td></tr>#{/list}#</table>diff --git a/htroot/AccessTracker_p.java b/htroot/AccessTracker_p.javaindex 2c4eb05b4..acdeaa362 100644--- a/htroot/AccessTracker_p.java+++ b/htroot/AccessTracker_p.java@@ -35,7 +35,6 @@ import java.util.concurrent.LinkedBlockingQueue;import net.yacy.cora.date.GenericFormatter;import net.yacy.cora.protocol.Domains;-import net.yacy.cora.protocol.HeaderFramework;import net.yacy.cora.protocol.RequestHeader;import net.yacy.cora.util.ConcurrentLog;import net.yacy.peers.Seed;@@ -56,6 +55,19 @@ public class AccessTracker_p {} catch (final ConcurrentModificationException e) {}return accessClone;}++ /**+ * Remove any eventual slash character at the beginning of path.+ * @param path a path relative to YaCy context+ * @return the path relative to this servlet : with no starting slash+ */+ private static String getRelativePathToThis(final String path) {+ String relativePath = path;+ if(path != null && path.startsWith("/")) {+ relativePath = relativePath.substring(1, relativePath.length());+ }+ return relativePath;+ }public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {final Switchboard sb = (Switchboard) env;@@ -109,6 +121,10 @@ public class AccessTracker_p {prop.putHTML("page_list_" + entCount + "_host", host);prop.put("page_list_" + entCount + "_date", GenericFormatter.SIMPLE_FORMATTER.format(new Date(entry.getTime())));prop.putHTML("page_list_" + entCount + "_path", entry.getPath());+ /* For better integration of YaCy peers behind a reverse proxy subfolder,+ * ensure a path relative to this servlet (with no starting slash) is used for links URLs.+ * We keep the pathes starting with a slash for display only. */+ prop.putHTML("page_list_" + entCount + "_relativePath", getRelativePathToThis(entry.getPath()));entCount++;}} catch (final ConcurrentModificationException e) {@@ -128,6 +144,10 @@ public class AccessTracker_p {prop.putHTML("page_list_" + entCount + "_host", host);prop.put("page_list_" + entCount + "_date", GenericFormatter.SIMPLE_FORMATTER.format(new Date(entry.getTime())));prop.putHTML("page_list_" + entCount + "_path", entry.getPath());+ /* For better integration of YaCy peers behind a reverse proxy subfolder,+ * ensure a path relative to this servlet (with no starting slash) is used for links URLs.+ * We keep the pathes starting with a slash for display only. */+ prop.putHTML("page_list_" + entCount + "_relativePath", getRelativePathToThis(entry.getPath()));entCount++;}}