/** @throws IOException If failed. */
  private void initFavicon() throws IOException {
    assert favicon == null;

    InputStream in = getClass().getResourceAsStream("favicon.ico");

    if (in != null) {
      BufferedInputStream bis = new BufferedInputStream(in);

      ByteArrayOutputStream bos = new ByteArrayOutputStream();

      try {
        byte[] buf = new byte[2048];

        while (true) {
          int n = bis.read(buf);

          if (n == -1) break;

          bos.write(buf, 0, n);
        }

        favicon = bos.toByteArray();
      } finally {
        U.closeQuiet(bis);
      }
    }
  }
  /** @throws IOException If failed. */
  private void initDefaultPage() throws IOException {
    assert dfltPage == null;

    InputStream in = getClass().getResourceAsStream("rest.html");

    if (in != null) {
      LineNumberReader rdr = new LineNumberReader(new InputStreamReader(in));

      try {
        StringBuilder buf = new StringBuilder(2048);

        for (String line = rdr.readLine(); line != null; line = rdr.readLine()) {
          buf.append(line);

          if (!line.endsWith(" ")) buf.append(" ");
        }

        dfltPage = buf.toString();
      } finally {
        U.closeQuiet(rdr);
      }
    }
  }