예제 #1
0
 public synchronized PathMatcher addExactPath(final String path, final T handler) {
   if (path.isEmpty()) {
     throw UndertowMessages.MESSAGES.pathMustBeSpecified();
   }
   exactPathMatches.put(URLUtils.normalizeSlashes(path), handler);
   return this;
 }
예제 #2
0
  public synchronized PathMatcher removeExactPath(final String path) {
    if (path == null || path.isEmpty()) {
      throw UndertowMessages.MESSAGES.pathMustBeSpecified();
    }

    exactPathMatches.remove(URLUtils.normalizeSlashes(path));

    return this;
  }
예제 #3
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();
  }
예제 #4
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;
  }
예제 #5
0
 public T getExactPath(final String path) {
   return exactPathMatches.get(URLUtils.normalizeSlashes(path));
 }