コード例 #1
0
  /** Responds a list of all languages for which the block does not have a title yet. */
  @Override
  public void execute(
      HttpServletRequest request,
      HttpServletResponse response,
      String memoryName,
      File currentFile,
      String partArg,
      Map<?, ?> query,
      OMM omm) {

    LOGGER.debug("multilang");
    String multilangarg[] = partArg.split("!");
    String blockName = "";
    try {
      blockName = URLDecoder.decode(multilangarg[1].split("_")[1], "UTF-8");
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
    }

    StringBuilder langs = new StringBuilder();
    Locale locales[] = Locale.getAvailableLocales();
    List<String> multilangs = new ArrayList<String>();
    List<String> availableLangs = new ArrayList<String>();
    OMMBlock block = omm.getBlock(blockName);
    List<String> curLangs = new ArrayList<String>();
    for (Locale loc : block.getTitle().keySet()) {
      curLangs.add(loc.getDisplayLanguage(Locale.ENGLISH));
    }
    for (Locale loc : locales) {
      availableLangs.add(loc.getDisplayLanguage(Locale.ENGLISH));
    }
    Tools.removeDuplicate(availableLangs);
    for (String lang : availableLangs) {
      if (!curLangs.contains(lang)) multilangs.add(lang);
    }

    Collections.sort(multilangs);
    // langs.deleteCharAt(langs.lastIndexOf(","));
    for (int i = 0; i < multilangs.size(); i++) {
      langs.append(multilangs.get(i));
      langs.append(",");
    }
    langs.deleteCharAt(langs.lastIndexOf(","));
    LOGGER.debug(langs.toString());
    Tools.transferBufferWithCompression(langs.toString().getBytes(), response, request);
  }
コード例 #2
0
  /** Responds all known payload ID info keys. */
  @Override
  public void execute(
      HttpServletRequest request,
      HttpServletResponse response,
      String memoryName,
      File currentFile,
      String partArg,
      Map<?, ?> query,
      OMM omm) {

    LOGGER.debug("payloadidinfokeys");
    String keys = "url,email";
    Tools.transferBufferWithCompression(keys.getBytes(), response, request);
  }