Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
add exit proxy link to UrlProxy on proxied pages a link to exit proxy is added to top of page. Link text can be configured in web.xml init-parameter (see default/web.xml). If missing no link is displayed.
regerd812f80784a7
diff --git a/defaults/web.xml b/defaults/web.xmlindex 6c8b409bb..c31cc39b7 100644--- a/defaults/web.xml+++ b/defaults/web.xml@@ -47,6 +47,11 @@<servlet-class>net.yacy.http.servlets.YaCyProxyServlet</servlet-class>--><servlet-class>net.yacy.http.servlets.UrlProxyServlet</servlet-class>+ <init-param>+ <description>Link text on top of proxied page to stop use of proxy</description>+ <param-name>stopProxyText</param-name>+ <param-value>YaCy stop proxy</param-value>+ </init-param></servlet><!-- mappings activated by the application - hardcoded (added here for completness) -->diff --git a/source/net/yacy/http/servlets/UrlProxyServlet.java b/source/net/yacy/http/servlets/UrlProxyServlet.javaindex 626f1c2b7..f9a7cb9e6 100644--- a/source/net/yacy/http/servlets/UrlProxyServlet.java+++ b/source/net/yacy/http/servlets/UrlProxyServlet.java@@ -75,12 +75,18 @@ import org.jsoup.select.Elements;*/public class UrlProxyServlet extends ProxyServlet implements Servlet {+ private String _stopProxyText = null;+@Overridepublic void init(ServletConfig config) throws ServletException {super.init(config);// must be lower case (header names are internally converted to lower)_DontProxyHeaders.add("host"); // to prevent Host header setting from original servletrequest (which is localhost)+ String tmps = config.getInitParameter("stopProxyText");+ if (tmps != null) {+ _stopProxyText = tmps;+ }}/* ------------------------------------------------------------ */@@ -248,8 +254,11 @@ public class UrlProxyServlet extends ProxyServlet implements Servlet {// 8 - add interaction elements (e.g. proxy exit button to switch back to original url)// TODO: use a template file for- //de.prepend("<div><form action='" + proxyurl + "'><input type='submit' value='YaCy stop proxy' /></form></div>");-+ if (_stopProxyText != null) {+ bde.prepend("<div width='100%' style='padding:5px; background:white; border-bottom: medium solid lightgrey;'>"+ + "<div align='center' style='font-size:11px; color:darkgrey;'><a href='" + proxyurl + "'>" + _stopProxyText + "</a></div></div>");+ }+// 9 - deliver to clientbyte[] sbb = UTF8.getBytes(doc.toString());