allow to choose used http server, YaCy-Anomic or Jetty

- defaults to Jetty (in this branch)
- add server version info & config option -> Admin Console -> Advanced Settings -> Http Networking
pull/1/head
reger 11 years ago
parent da4ff5aefa
commit f46c723398

@ -8,7 +8,8 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# the HTTP service configurations # the HTTP service configurations
# choices are jetty or anomic
defaulthttpserver=jetty
# port number where the server should bind to # port number where the server should bind to
port = 8090 port = 8090

@ -33,4 +33,23 @@
</tr> </tr>
</table> </table>
</fieldset> </fieldset>
</form><br />
<form>
<fieldset><legend id="httpserver">HTTP Server</legend>
<table border="0" cellspacing="5">
<tr>
<td>HTTP Server Version:</td>
<td><b>#[httpservername]#</b></td>
</tr>
<tr>
<td>set default server to</td>
<td><select name="defaulthttpserver">
<option value="jetty">Jetty</optioon>
<option value="anomic">YaCy Anomic HTTPD</option>
</select>
<input type="submit" name="setdefaulthttpserver" value="Submit" /></td>
<td><em>Changes effective after a restart</em></td>
</tr>
</table>
</fieldset>
</form><br /> </form><br />

@ -190,6 +190,11 @@ public final class Settings_p {
prop.putHTML("crawler.smb.maxFileSize",sb.getConfig("crawler.smb.maxFileSize", "-1")); prop.putHTML("crawler.smb.maxFileSize",sb.getConfig("crawler.smb.maxFileSize", "-1"));
prop.putHTML("crawler.file.maxFileSize",sb.getConfig("crawler.file.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 rewrite properties
return prop; return prop;
} }

@ -65,6 +65,7 @@ import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants; import net.yacy.search.SwitchboardConstants;
import com.google.common.io.Files; import com.google.common.io.Files;
import net.yacy.server.http.HTTPDemon;
import net.yacy.server.serverCore; import net.yacy.server.serverCore;
@ -330,27 +331,29 @@ public final class yacy {
// start main threads // start main threads
final int port = sb.getConfigInt("port", 8090); final int port = sb.getConfigInt("port", 8090);
try { try {
// start http server
// start jetty http server YaCyHttpServer httpServer;
YaCyHttpServer httpServer = new Jetty8HttpServerImpl(port); // default jetty (alternative "anomichttpd")
httpServer.startupServer(); 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); sb.setHttpServer(httpServer);
ConcurrentLog.info("STARTUP",httpServer.getVersion()); 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 // open the browser window
final boolean browserPopUpTrigger = sb.getConfig(SwitchboardConstants.BROWSER_POP_UP_TRIGGER, "true").equals("true"); final boolean browserPopUpTrigger = sb.getConfig(SwitchboardConstants.BROWSER_POP_UP_TRIGGER, "true").equals("true");
if (browserPopUpTrigger) try { if (browserPopUpTrigger) try {

Loading…
Cancel
Save