object PathDirectives extends PathDirectives
- Grouped
- Alphabetic
- By Inheritance
- PathDirectives
- PathDirectives
- ToNameReceptacleEnhancements
- ImplicitPathMatcherConstruction
- PathMatchers
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- abstract class NumberMatcher[T] extends PathMatcher1[T]
- Definition Classes
- PathMatchers
Value Members
- object HexIntNumber extends NumberMatcher[Int]
A PathMatcher that efficiently matches a number of hex-digits and extracts their (non-negative) Int value.
A PathMatcher that efficiently matches a number of hex-digits and extracts their (non-negative) Int value. The matcher will not match 0 digits or a sequence of digits that would represent an Int value larger than Int.MaxValue.
- Definition Classes
- PathMatchers
- object HexLongNumber extends NumberMatcher[Long]
A PathMatcher that efficiently matches a number of hex-digits and extracts their (non-negative) Long value.
A PathMatcher that efficiently matches a number of hex-digits and extracts their (non-negative) Long value. The matcher will not match 0 digits or a sequence of digits that would represent an Long value larger than Long.MaxValue.
- Definition Classes
- PathMatchers
- object IntNumber extends NumberMatcher[Int]
A PathMatcher that efficiently matches a number of digits and extracts their (non-negative) Int value.
A PathMatcher that efficiently matches a number of digits and extracts their (non-negative) Int value. The matcher will not match 0 digits or a sequence of digits that would represent an Int value larger than Int.MaxValue.
- Definition Classes
- PathMatchers
- object LongNumber extends NumberMatcher[Long]
A PathMatcher that efficiently matches a number of digits and extracts their (non-negative) Long value.
A PathMatcher that efficiently matches a number of digits and extracts their (non-negative) Long value. The matcher will not match 0 digits or a sequence of digits that would represent an Long value larger than Long.MaxValue.
- Definition Classes
- PathMatchers
- object PathEnd extends PathMatcher0
A PathMatcher that matches the very end of the requests URI path.
A PathMatcher that matches the very end of the requests URI path.
- Definition Classes
- PathMatchers
- object Remaining extends PathMatcher1[String]
A PathMatcher that matches and extracts the complete remaining, unmatched part of the request's URI path as an (encoded!) String.
A PathMatcher that matches and extracts the complete remaining, unmatched part of the request's URI path as an (encoded!) String. If you need access to the remaining unencoded elements of the path use the
RemainingPath
matcher!- Definition Classes
- PathMatchers
- object RemainingPath extends PathMatcher1[Path]
A PathMatcher that matches and extracts the complete remaining, unmatched part of the request's URI path.
A PathMatcher that matches and extracts the complete remaining, unmatched part of the request's URI path.
- Definition Classes
- PathMatchers
- object Segment extends PathMatcher1[String]
A PathMatcher that matches if the unmatched path starts with a path segment.
A PathMatcher that matches if the unmatched path starts with a path segment. If so the path segment is extracted as a String.
- Definition Classes
- PathMatchers
- object Slash extends PathMatcher0
A PathMatcher that matches a single slash character ('/').
A PathMatcher that matches a single slash character ('/').
- Definition Classes
- PathMatchers
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val DoubleNumber: PathMatcher1[Double]
A PathMatcher that matches and extracts a Double value.
A PathMatcher that matches and extracts a Double value. The matched string representation is the pure decimal, optionally signed form of a double value, i.e. without exponent.
- Definition Classes
- PathMatchers
- val JavaUUID: PathMatcher1[UUID]
A PathMatcher that matches and extracts a java.util.UUID instance.
A PathMatcher that matches and extracts a java.util.UUID instance.
- Definition Classes
- PathMatchers
- val Neutral: PathMatcher0
A PathMatcher that always matches, doesn't consume anything and extracts nothing.
A PathMatcher that always matches, doesn't consume anything and extracts nothing. Serves mainly as a neutral element in PathMatcher composition.
- Definition Classes
- PathMatchers
- def Segments(min: Int, max: Int): PathMatcher1[List[String]]
A PathMatcher that matches between
min
andmax
(both inclusively) path segments (separated by slashes) as a List[String].A PathMatcher that matches between
min
andmax
(both inclusively) path segments (separated by slashes) as a List[String]. If there are more thancount
segments present the remaining ones will be left unmatched. If the path has a trailing slash this slash will *not* be matched.- Definition Classes
- PathMatchers
- def Segments(count: Int): PathMatcher1[List[String]]
A PathMatcher that matches the given number of path segments (separated by slashes) as a List[String].
A PathMatcher that matches the given number of path segments (separated by slashes) as a List[String]. If there are more than
count
segments present the remaining ones will be left unmatched. If the path has a trailing slash this slash will *not* be matched.- Definition Classes
- PathMatchers
- val Segments: PathMatcher1[List[String]]
A PathMatcher that matches up to 128 remaining segments as a List[String].
A PathMatcher that matches up to 128 remaining segments as a List[String]. This can also be no segments resulting in the empty list. If the path has a trailing slash this slash will *not* be matched.
- Definition Classes
- PathMatchers
- implicit def _regex2PathMatcher(regex: Regex): PathMatcher1[String]
Creates a PathMatcher that consumes (a prefix of) the first path segment if the path begins with a segment (a prefix of) which matches the given regex.
Creates a PathMatcher that consumes (a prefix of) the first path segment if the path begins with a segment (a prefix of) which matches the given regex. Extracts either the complete match (if the regex doesn't contain a capture group) or the capture group (if the regex contains exactly one). If the regex contains more than one capture group the method throws an IllegalArgumentException.
- Definition Classes
- ImplicitPathMatcherConstruction
- implicit def _segmentStringToPathMatcher(segment: String): PathMatcher0
Creates a PathMatcher that consumes (a prefix of) the first path segment (if the path begins with a segment).
Creates a PathMatcher that consumes (a prefix of) the first path segment (if the path begins with a segment).
- Definition Classes
- ImplicitPathMatcherConstruction
- implicit def _string2NR(string: String): NameReceptacle[String]
- Definition Classes
- ToNameReceptacleEnhancements
- Annotations
- @implicitAmbiguous()
- implicit def _stringExtractionPair2PathMatcher[T](tuple: (String, T)): PathMatcher1[T]
Creates a PathMatcher that consumes (a prefix of) the first path segment (if the path begins with a segment) and extracts a given value.
Creates a PathMatcher that consumes (a prefix of) the first path segment (if the path begins with a segment) and extracts a given value.
- Definition Classes
- ImplicitPathMatcherConstruction
- implicit def _stringNameOptionReceptacle2PathMatcher(nr: NameOptionReceptacle[String]): PathMatcher0
- Definition Classes
- ImplicitPathMatcherConstruction
- implicit def _symbol2NR(symbol: Symbol): NameReceptacle[String]
- Definition Classes
- ToNameReceptacleEnhancements
- implicit def _valueMap2PathMatcher[T](valueMap: Map[String, T]): PathMatcher1[T]
Creates a PathMatcher from the given Map of path segments (prefixes) to extracted values.
Creates a PathMatcher from the given Map of path segments (prefixes) to extracted values. If the unmatched path starts with a segment having one of the maps keys as a prefix the matcher consumes this path segment (prefix) and extracts the corresponding map value. For keys sharing a common prefix the longest matching prefix is selected.
- Definition Classes
- ImplicitPathMatcherConstruction
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def ignoreTrailingSlash: Directive0
Tries to match the inner route and if it fails with an empty rejection, it tries it again adding (or removing) the trailing slash on the given path.
Tries to match the inner route and if it fails with an empty rejection, it tries it again adding (or removing) the trailing slash on the given path.
- Definition Classes
- PathDirectives
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def not(self: PathMatcher[_]): PathMatcher0
- Definition Classes
- PathMatchers
- def nothingMatcher[L](implicit arg0: Tuple[L]): PathMatcher[L]
A PathMatcher that never matches anything.
A PathMatcher that never matches anything.
- Definition Classes
- PathMatchers
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def path[L](pm: PathMatcher[L]): Directive[L]
Applies the given PathMatcher to the remaining unmatched path after consuming a leading slash.
Applies the given PathMatcher to the remaining unmatched path after consuming a leading slash. The matcher has to match the remaining path completely. If matched the value extracted by the PathMatcher is extracted on the directive level.
- Definition Classes
- PathDirectives
- def pathEnd: Directive0
Rejects the request if the unmatchedPath of the RequestContext is non-empty, or said differently: only passes on the request to its inner route if the request path has been matched completely.
Rejects the request if the unmatchedPath of the RequestContext is non-empty, or said differently: only passes on the request to its inner route if the request path has been matched completely.
- Definition Classes
- PathDirectives
- def pathEndOrSingleSlash: Directive0
Only passes on the request to its inner route if the request path has been matched completely or only consists of exactly one remaining slash.
Only passes on the request to its inner route if the request path has been matched completely or only consists of exactly one remaining slash.
Note that trailing slash and non-trailing slash URLs are not the same, although they often serve the same content. It is recommended to serve only one URL version and make the other redirect to it using redirectToTrailingSlashIfMissing or redirectToNoTrailingSlashIfPresent directive.
For example:
def route = { // redirect '/users/' to '/users', '/users/:userId/' to '/users/:userId' redirectToNoTrailingSlashIfPresent(Found) { pathPrefix("users") { concat( pathEnd { // user list ... }, path(UUID) { userId => // user profile ... } ) } } }
For further information, refer to:
- Definition Classes
- PathDirectives
- See also
https://webmasters.googleblog.com/2010/04/to-slash-or-not-to-slash.html
- def pathPrefix[L](pm: PathMatcher[L]): Directive[L]
Applies the given PathMatcher to a prefix of the remaining unmatched path after consuming a leading slash.
Applies the given PathMatcher to a prefix of the remaining unmatched path after consuming a leading slash. The matcher has to match a prefix of the remaining path. If matched the value extracted by the PathMatcher is extracted on the directive level.
- Definition Classes
- PathDirectives
- def pathPrefixTest[L](pm: PathMatcher[L]): Directive[L]
Checks whether the unmatchedPath of the RequestContext has a prefix matched by the given PathMatcher.
Checks whether the unmatchedPath of the RequestContext has a prefix matched by the given PathMatcher. In analogy to the
pathPrefix
directive a leading slash is implied.- Definition Classes
- PathDirectives
- def pathSingleSlash: Directive0
Only passes on the request to its inner route if the request path consists of exactly one remaining slash.
Only passes on the request to its inner route if the request path consists of exactly one remaining slash.
- Definition Classes
- PathDirectives
- def pathSuffix[L](pm: PathMatcher[L]): Directive[L]
Applies the given PathMatcher to a suffix of the remaining unmatchedPath of the RequestContext.
Applies the given PathMatcher to a suffix of the remaining unmatchedPath of the RequestContext. If matched the value extracted by the PathMatcher is extracted and the matched parts of the path are consumed. Note that, for efficiency reasons, the given PathMatcher must match the desired suffix in reversed-segment order, i.e.
pathSuffix("baz" / "bar")
would match/foo/bar/baz
!- Definition Classes
- PathDirectives
- def pathSuffixTest[L](pm: PathMatcher[L]): Directive[L]
Checks whether the unmatchedPath of the RequestContext has a suffix matched by the given PathMatcher.
Checks whether the unmatchedPath of the RequestContext has a suffix matched by the given PathMatcher. However, as opposed to the pathSuffix directive the matched path is not actually "consumed". Note that, for efficiency reasons, the given PathMatcher must match the desired suffix in reversed-segment order, i.e.
pathSuffixTest("baz" / "bar")
would match/foo/bar/baz
!- Definition Classes
- PathDirectives
- def rawPathPrefix[L](pm: PathMatcher[L]): Directive[L]
Applies the given matcher directly to a prefix of the unmatched path of the RequestContext (i.e.
Applies the given matcher directly to a prefix of the unmatched path of the RequestContext (i.e. without implicitly consuming a leading slash). The matcher has to match a prefix of the remaining path. If matched the value extracted by the PathMatcher is extracted on the directive level.
- Definition Classes
- PathDirectives
- def rawPathPrefixTest[L](pm: PathMatcher[L]): Directive[L]
Checks whether the unmatchedPath of the RequestContext has a prefix matched by the given PathMatcher.
Checks whether the unmatchedPath of the RequestContext has a prefix matched by the given PathMatcher. However, as opposed to the
pathPrefix
directive the matched path is not actually "consumed".- Definition Classes
- PathDirectives
- def redirectToNoTrailingSlashIfPresent(redirectionType: Redirection): Directive0
If the request path ends with a slash, redirect to the same uri without trailing slash in the path.
If the request path ends with a slash, redirect to the same uri without trailing slash in the path.
Note, however, that this directive doesn't apply to a URI consisting of just a single slash. HTTP does not support empty target paths, so that browsers will convert a URI such as
http://example.org
tohttp://example.org/
adding the trailing slash.Redirecting the single slash path URI would lead to a redirection loop.
Caveat: pathSingleSlash directive will only match on the root path level inside of this directive.
- Definition Classes
- PathDirectives
- def redirectToTrailingSlashIfMissing(redirectionType: Redirection): Directive0
If the request path doesn't end with a slash, redirect to the same uri with trailing slash in the path.
If the request path doesn't end with a slash, redirect to the same uri with trailing slash in the path.
Caveat: path without trailing slash and pathEnd directives will not match inside of this directive.
- Definition Classes
- PathDirectives
- def separateOnSlashes(string: String): PathMatcher0
Converts a path string containing slashes into a PathMatcher that interprets slashes as path segment separators.
Converts a path string containing slashes into a PathMatcher that interprets slashes as path segment separators.
- Definition Classes
- PathMatchers
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()