Beispiel #1
0
  public T getPrefixPath(final String path) {

    final String normalizedPath = URLUtils.normalizeSlashes(path);

    // enable the prefix path mechanism to return the default handler
    SubstringMap.SubstringMatch<T> match = paths.get(normalizedPath);
    if (PathMatcher.STRING_PATH_SEPARATOR.equals(normalizedPath) && match == null) {
      return this.defaultHandler;
    }
    if (match == null) {
      return null;
    }

    // return the value for the given path
    return match.getValue();
  }
Beispiel #2
0
  public synchronized PathMatcher removePrefixPath(final String path) {
    if (path == null || path.isEmpty()) {
      throw UndertowMessages.MESSAGES.pathMustBeSpecified();
    }

    final String normalizedPath = URLUtils.normalizeSlashes(path);

    if (PathMatcher.STRING_PATH_SEPARATOR.equals(normalizedPath)) {
      defaultHandler = null;
      return this;
    }

    paths.remove(normalizedPath);

    buildLengths();
    return this;
  }