xmlRpcServer = new XmlrpcServer(port);
xmlRpcServer.addHandler(XMLRPC_CONTEXT, new VectorResults(baseSearcher));
xmlRpcServer.start();
}
if (openSearch || web || xml) {
Config config = Config.getConfig("searcher.properties");
int httpServerPort = PortUtil.getPort("searcher.http");
httpServer = new WebServer(httpServerPort);
if (openSearch) {
String context = config.getString("opensearch.context");
logger.info("MultipleRpcSearcher constructor: starting OpenSearch searcher on port " + httpServerPort + " context "+context);
httpServer.addHandler(context, new OpenSearchHandler(baseSearcher));
}
if (xml) {
String context = config.getString("xmlsearch.context");
logger.info("MultipleRpcSearcher constructor: starting xml searcher on port " + httpServerPort + " context "+context);
httpServer.addHandler(context, new XmlSearchHandler(baseSearcher));
}
if (web) {
String context = config.getString("websearch.context");
logger.info("MultipleRpcSearcher constructor: starting web searcher on port " + httpServerPort + " context "+context);
WebSearchUtil.setSearcher(baseSearcher);
String webappPath = this.getClass().getClassLoader().getResource("web-searcher").getPath();
httpServer.addWebAppHandler(context, webappPath);
}
boolean redirect = config.getBoolean("websearch.redirect");
if (redirect) {
String from = config.getString("websearch.redirect.from");
String to = config.getString("websearch.redirect.to");
httpServer.addHandler("/", new RedirectHandler(from,to));
}
try {httpServer.start();} catch (Exception e) {throw new RuntimeException(e);}
}
}