public Object getCommand(final String iName) {
    OServerCommand cmd = exactCommands.get(iName);

    if (cmd == null) {
      for (Entry<String, OServerCommand> entry : restCommands.entrySet()) {
        if (matches(entry.getKey(), iName)) {
          return entry.getValue();
        }
      }
    }
    if (cmd == null) {
      // TRY WITH WILDCARD COMMANDS
      // TODO: OPTIMIZE SEARCH!
      String partLeft, partRight;
      for (Entry<String, OServerCommand> entry : wildcardCommands.entrySet()) {
        final int wildcardPos = entry.getKey().indexOf('*');
        partLeft = entry.getKey().substring(0, wildcardPos);
        partRight = entry.getKey().substring(wildcardPos + 1);

        if (iName.startsWith(partLeft) && iName.endsWith(partRight)) {
          cmd = entry.getValue();
          break;
        }
      }
    }

    if (cmd == null && parent != null) cmd = (OServerCommand) parent.getCommand(iName);

    return cmd;
  }
 protected String findUrlPattern(String requestUrl) {
   for (Entry<String, OServerCommand> entry : restCommands.entrySet()) {
     if (matches(entry.getKey(), requestUrl)) {
       return entry.getKey();
     }
   }
   if (parent == null) {
     return null;
   } else {
     return parent.findUrlPattern(requestUrl);
   }
 }