Ejemplo n.º 1
0
  /** Returns the number of routes in this router. */
  public int size() {
    int ret = anyMethodRouter.size();

    for (MethodlessRouter<T> router : routers.values()) {
      ret += router.size();
    }

    return ret;
  }
Ejemplo n.º 2
0
 /** Returns all methods that this router handles. For {@code OPTIONS *}. */
 public Set<HttpMethod> allAllowedMethods() {
   if (anyMethodRouter.size() > 0) {
     final Set<HttpMethod> ret = new HashSet<HttpMethod>(9);
     ret.add(HttpMethod.CONNECT);
     ret.add(HttpMethod.DELETE);
     ret.add(HttpMethod.GET);
     ret.add(HttpMethod.HEAD);
     ret.add(HttpMethod.OPTIONS);
     ret.add(HttpMethod.PATCH);
     ret.add(HttpMethod.POST);
     ret.add(HttpMethod.PUT);
     ret.add(HttpMethod.TRACE);
     return ret;
   } else {
     return new HashSet<HttpMethod>(routers.keySet());
   }
 }