/**
   * Simple default handler lookup implementation. Return the registered handler whose path is
   * identical to <code>path</code> or is the longest prefix of <code>path</code>.
   *
   * @param path
   * @return PropertyList
   */
  public PropertyList lookupHandler(String path) {
    {
      HttpServer server = this;

      if (Http.$HTTP_SERVER_IMPLEMENTATION$ == null) {
        throw ((StellaException)
            (StellaException.newStellaException(
                    "lookup-handler: no HTTP server implementation loaded")
                .fillInStackTrace()));
      }
      {
        PropertyList handler =
            ((PropertyList) (Http.$HTTP_HANDLER_REGISTRY$.lookup(StringWrapper.wrapString(path))));
        String handlerpath = null;
        int handlerpathlength = 0;

        if (handler != null) {
          return (handler);
        }
        {
          StringWrapper p = null;
          PropertyList h = null;
          DictionaryIterator iter000 =
              ((DictionaryIterator) (Http.$HTTP_HANDLER_REGISTRY$.allocateIterator()));

          while (iter000.nextP()) {
            p = ((StringWrapper) (iter000.key));
            h = ((PropertyList) (iter000.value));
            if (Stella.startsWithP(path, p.wrapperValue, 0)) {
              if ((handler == null)
                  || ((StringWrapper.unwrapString(p)).length() > handlerpathlength)) {
                handler = h;
                handlerpath = p.wrapperValue;
                handlerpathlength = handlerpath.length();
              }
            }
          }
        }
        return (handler);
      }
    }
  }