public void addAction(String action, String regex, HttpServerRequestCallback callback) {
    Pair p = new Pair();
    p.regex = Pattern.compile("^" + regex);
    p.callback = callback;

    synchronized (mActions) {
      ArrayList<Pair> pairs = mActions.get(action);
      if (pairs == null) {
        pairs = new ArrayList<AsyncHttpServer.Pair>();
        mActions.put(action, pairs);
      }
      pairs.add(p);
    }
  }