PathDirectives • Akka HTTP (original) (raw)
- Overview of path directives
- path
- pathEnd
- pathEndOrSingleSlash
- pathPrefix
- pathPrefixTest
- pathSingleSlash
- pathSuffix
- pathSuffixTest
- rawPathPrefix
- rawPathPrefixTest
- redirectToNoTrailingSlashIfPresent
- redirectToTrailingSlashIfMissing
- ignoreTrailingSlash
- The PathMatcher DSL
Overview of path directives
This is a tiny overview for some of the most common path directives:
rawPathPrefix(x)
: it matches x and leaves a suffix (if any) unmatched.pathPrefix(x)
: is equivalent torawPathPrefix(Slash ~ x)
rawPathPrefix(slash().concat(segment(x)))
. It matches a leading slash followed by x and then leaves a suffix unmatched.path(x)
: is equivalent torawPathPrefix(Slash ~ x ~ PathEnd)
rawPathPrefix(slash().concat(segment(x)).concat(pathEnd()))
. It matches a leading slash followed by x and then the end.pathEnd
: is equivalent to justrawPathPrefix(PathEnd)
rawPathPrefix(pathEnd())
. It is matched only when there is nothing left to match from the path. This directive should not be used at the root as the minimal path is the single slash.pathSingleSlash
: is equivalent torawPathPrefix(Slash ~ PathEnd)
rawPathPrefix(slash().concat(pathEnd()))
. It matches when the remaining path is just a single slash.pathEndOrSingleSlash
: is equivalent torawPathPrefix(PathEnd)
rawPathPrefix(pathEnd())
orrawPathPrefix(Slash ~ PathEnd)
rawPathPrefix(slash().concat(pathEnd()))
. It matches either when there is no remaining path or is just a single slash.
Found an error in this documentation? The source code for this page can be found here. Please feel free to edit and contribute a pull request.