diff --git a/htroot/ConfigSearchBox.html b/htroot/ConfigSearchBox.html index 19dfc9fda..0679a33eb 100644 --- a/htroot/ConfigSearchBox.html +++ b/htroot/ConfigSearchBox.html @@ -17,7 +17,7 @@ Simply use the following code:
-<form method="get" accept-charset="UTF-8" action="http://#[myaddress]#/yacysearch.html">
+<form method="get" accept-charset="UTF-8" action="#[myaddress]#/yacysearch.html">
   <div style="text-align:center; padding:5px; background-color:#eeeeee; border:1px solid #cccccc; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; display:block; float:left; margin-right:5px;">
     <div style="font-family:Arial,Helvetica,sans-serif; font-size:16px; display:block; float:left; padding-top:3px; padding-right:5px;">
       MySearch
@@ -41,7 +41,7 @@
     
This would look like: -
+
MySearch diff --git a/htroot/ConfigSearchBox.java b/htroot/ConfigSearchBox.java index 37bf79ff9..05bde9ac3 100644 --- a/htroot/ConfigSearchBox.java +++ b/htroot/ConfigSearchBox.java @@ -24,19 +24,19 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import net.yacy.cora.protocol.RequestHeader; +import net.yacy.http.servlets.YaCyDefaultServlet; import net.yacy.search.Switchboard; import net.yacy.server.serverObjects; import net.yacy.server.serverSwitch; public class ConfigSearchBox { - public static serverObjects respond(@SuppressWarnings("unused") final RequestHeader header, @SuppressWarnings("unused") final serverObjects post, final serverSwitch env) { + public static serverObjects respond(final RequestHeader header, @SuppressWarnings("unused") final serverObjects post, final serverSwitch env) { final serverObjects prop = new serverObjects(); final Switchboard sb = (Switchboard) env; - String myaddress = sb.peers.mySeed().getIP() == null ? null : sb.peers.mySeed().getPublicAddress(sb.peers.mySeed().getIP()); - if (myaddress == null) myaddress = "localhost:" + sb.getLocalPort(); - prop.put("myaddress", myaddress); + /* Fill the base URL used to render a sample code integration example */ + prop.put("myaddress", YaCyDefaultServlet.getContext(header, sb)); return prop; }