diff --git a/defaults/yacy.init b/defaults/yacy.init index 1398c0697..98a1664fd 100644 --- a/defaults/yacy.init +++ b/defaults/yacy.init @@ -8,7 +8,8 @@ # ---------------------------------------------------------------------------- # the HTTP service configurations - +# choices are jetty or anomic +defaulthttpserver=jetty # port number where the server should bind to port = 8090 diff --git a/htroot/Settings_Http.inc b/htroot/Settings_Http.inc index 8a23ace87..72d2f7fcd 100644 --- a/htroot/Settings_Http.inc +++ b/htroot/Settings_Http.inc @@ -33,4 +33,23 @@ +
+
+
HTTP Server + + + + + + + + + + +
HTTP Server Version:#[httpservername]#
set default server to + Changes effective after a restart
+

\ No newline at end of file diff --git a/htroot/Settings_p.java b/htroot/Settings_p.java index 92bd3929f..91e2c3992 100644 --- a/htroot/Settings_p.java +++ b/htroot/Settings_p.java @@ -190,6 +190,11 @@ public final class Settings_p { prop.putHTML("crawler.smb.maxFileSize",sb.getConfig("crawler.smb.maxFileSize", "-1")); prop.putHTML("crawler.file.maxFileSize",sb.getConfig("crawler.file.maxFileSize", "-1")); + prop.put("httpservername",sb.getHttpServer().getVersion()); + if (post != null && post.containsKey("setdefaulthttpserver")) { + String server = post.get("defaulthttpserver","jetty"); + sb.setConfig("defaulthttpserver",server); + } // return rewrite properties return prop; } diff --git a/source/net/yacy/yacy.java b/source/net/yacy/yacy.java index 9eac74edc..f4ac1049b 100644 --- a/source/net/yacy/yacy.java +++ b/source/net/yacy/yacy.java @@ -65,6 +65,7 @@ import net.yacy.search.Switchboard; import net.yacy.search.SwitchboardConstants; import com.google.common.io.Files; +import net.yacy.server.http.HTTPDemon; import net.yacy.server.serverCore; @@ -330,27 +331,29 @@ public final class yacy { // start main threads final int port = sb.getConfigInt("port", 8090); try { - - // start jetty http server - YaCyHttpServer httpServer = new Jetty8HttpServerImpl(port); - httpServer.startupServer(); + // start http server + YaCyHttpServer httpServer; + // default jetty (alternative "anomichttpd") + if (sb.getConfig("defaulthttpserver","jetty").equalsIgnoreCase("jetty")) { + httpServer = new Jetty8HttpServerImpl(port); + } else { + final HTTPDemon protocolHandler = new HTTPDemon(sb); + httpServer = new serverCore( + timeout /*control socket timeout in milliseconds*/, + true /* block attacks (wrong protocol) */, + protocolHandler /*command class*/, + sb, + 30000 /*command max length incl. GET args*/); + ((serverCore) httpServer).setName("httpd:"+port); + ((serverCore) httpServer).setPriority(Thread.MAX_PRIORITY); + ((serverCore) httpServer).setObeyIntermission(false); + // start the server + //sb.deployThread("10_httpd", "HTTPD Server/Proxy", "the HTTPD, used as web server and proxy", null, server, 0, 0, 0, 0); + } + httpServer.startupServer(); sb.setHttpServer(httpServer); ConcurrentLog.info("STARTUP",httpServer.getVersion()); - //final HTTPDemon protocolHandler = new HTTPDemon(sb); - //final serverCore server = new serverCore( - // timeout /*control socket timeout in milliseconds*/, - // true /* block attacks (wrong protocol) */, - // protocolHandler /*command class*/, - // sb, - // 30000 /*command max length incl. GET args*/); - //server.setName("httpd:"+port); - //server.setPriority(Thread.MAX_PRIORITY); - //server.setObeyIntermission(false); - // start the server - //sb.deployThread("10_httpd", "HTTPD Server/Proxy", "the HTTPD, used as web server and proxy", null, server, 0, 0, 0, 0); - //server.start(); - // open the browser window final boolean browserPopUpTrigger = sb.getConfig(SwitchboardConstants.BROWSER_POP_UP_TRIGGER, "true").equals("true"); if (browserPopUpTrigger) try {