diff --git a/defaults/web.xml b/defaults/web.xml index 6c8b409bb..c31cc39b7 100644 --- a/defaults/web.xml +++ b/defaults/web.xml @@ -47,6 +47,11 @@ net.yacy.http.servlets.YaCyProxyServlet --> net.yacy.http.servlets.UrlProxyServlet + + Link text on top of proxied page to stop use of proxy + stopProxyText + YaCy stop proxy + diff --git a/source/net/yacy/http/servlets/UrlProxyServlet.java b/source/net/yacy/http/servlets/UrlProxyServlet.java index 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; + @Override public 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("
"); - + if (_stopProxyText != null) { + bde.prepend("
" + + "
" + _stopProxyText + "
"); + } + // 9 - deliver to client byte[] sbb = UTF8.getBytes(doc.toString());