io.undertow.util

## Class PathMatcher<T>

- java.lang.Object
- - io.undertow.util.PathMatcher<T>

    public class PathMatcher<T>
    extends Object

Handler that dispatches to a given handler based of a prefix match of the path.

This only matches a single level of a request, e.g if you have a request that takes the form:

/foo/bar

Author:
  Stuart Douglas

### Nested Class Summary

Nested Classes
`static class` `PathMatcher.PathMatch<T>`

### Constructor Summary

Constructors
Constructor and Description
`PathMatcher()`
`PathMatcher(T defaultHandler)`

### Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods
`PathMatcher` `addExactPath(String path, T handler)`
`PathMatcher` `addPrefixPath(String path, T handler)` Adds a path prefix and a handler for that path.
`PathMatcher` `clearPaths()`
`T` `getExactPath(String path)`
`Set<String>` `getExactPathMatchesSet()`
`Set<String>` `getPathMatchesSet()`
`Map<String,T>` `getPaths()`
`T` `getPrefixPath(String path)`
`PathMatcher.PathMatch<T>` `match(String path)` Matches a path against the registered handlers.
`PathMatcher` `removeExactPath(String path)`
`PathMatcher` `removePath(String path)` Deprecated.
`PathMatcher` `removePrefixPath(String path)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### PathMatcher

    public PathMatcher(T defaultHandler)

#### PathMatcher

    public PathMatcher()

### Method Detail

#### getExactPathMatchesSet

    public Set<String> getExactPathMatchesSet()

#### getPathMatchesSet

    public Set<String> getPathMatchesSet()

#### match

    public PathMatcher.PathMatch<T> match(String path)

Matches a path against the registered handlers.

Parameters:
  `path` - The relative path to match
Returns:
  The match match. This will never be null, however if none matched its value field will be

#### addPrefixPath

    public PathMatcher addPrefixPath(String path,
                                     T handler)

Adds a path prefix and a handler for that path. If the path does not start with a / then one will be prepended.

The match is done on a prefix bases, so registering /foo will also match /foo/bar. Exact path matches are taken into account first.

If / is specified as the path then it will replace the default handler.

Parameters:
  `path` - The path
  `handler` - The handler

#### addExactPath

    public PathMatcher addExactPath(String path,
                                    T handler)

#### getExactPath

    public T getExactPath(String path)

#### getPrefixPath

    public T getPrefixPath(String path)

#### removePath

    @Deprecated
    public PathMatcher removePath(String path)

Deprecated.

#### removePrefixPath

    public PathMatcher removePrefixPath(String path)

#### removeExactPath

    public PathMatcher removeExactPath(String path)

#### clearPaths

    public PathMatcher clearPaths()

#### getPaths

    public Map<String,T> getPaths()