Example #1
0
  public static serverObjects respond(
      final RequestHeader header, final serverObjects post, final serverSwitch env) {
    // return variable that accumulates replacements
    final Switchboard sb = (Switchboard) env;
    final serverObjects prop = new serverObjects();

    // define visible variables
    String a = sb.peers.mySeed().getPublicAddress();
    if (a == null) a = "localhost:" + sb.getConfig("port", "8090");
    final boolean intranet = sb.getConfig(SwitchboardConstants.NETWORK_NAME, "").equals("intranet");
    final String repository = "http://" + a + "/repository/";
    prop.put("starturl", (intranet) ? repository : "http://");
    prop.put("address", a);

    // return rewrite properties
    return prop;
  }
Example #2
0
  /** Load or reload all active Blacklists */
  public static void reloadBlacklists() {
    final String supportedBlacklistTypesStr = Blacklist.BLACKLIST_TYPES_STRING;
    final String[] supportedBlacklistTypes = supportedBlacklistTypesStr.split(",");

    final List<BlacklistFile> blacklistFiles =
        new ArrayList<BlacklistFile>(supportedBlacklistTypes.length);
    for (String supportedBlacklistType : supportedBlacklistTypes) {
      final BlacklistFile blFile =
          new BlacklistFile(
              switchboard.getConfig(
                  supportedBlacklistType + ".BlackLists",
                  switchboard.getConfig("BlackLists.DefaultList", "url.default.black")),
              supportedBlacklistType);
      blacklistFiles.add(blFile);
    }

    Switchboard.urlBlacklist.clear();
    Switchboard.urlBlacklist.loadList(
        blacklistFiles.toArray(new BlacklistFile[blacklistFiles.size()]), "/");
    SearchEventCache.cleanupEvents(true);

    //       switchboard.urlBlacklist.clear();
    //       if (f != "") switchboard.urlBlacklist.loadLists("black", f, "/");
  }
Example #3
0
 /**
  * Get ListSet from configuration file and return it as a unified Set.
  *
  * <p><b>Meaning of ListSet</b>: There are various "lists" in YaCy which are actually disjunct
  * (pairwise unequal) sets which themselves can be seperated into different subsets. E.g., there
  * can be more than one blacklist of a type. A ListSet is the set of all those "lists" (subsets)
  * of an equal type.
  *
  * @param setName name of the ListSet
  * @return a ListSet from configuration file
  */
 public static Set<String> getListSet(final String setName) {
   return string2set(switchboard.getConfig(setName, ""));
 }