final case class RoutePattern[A](method: Method, pathCodec: PathCodec[A]) extends Product with Serializable
A pattern for matching routes that examines both HTTP method and path. In addition to specifying a method, patterns contain segment patterns, which are sequences of literals, integers, longs, and other segment types.
Typically, your entry point constructor for a route pattern would be zio.http.Method:
import zio.http.Method import zio.http.codec.SegmentCodec._ val pattern = Method.GET / "users" / int("user-id") / "posts" / string("post-id")
However, you can use the convenience constructors in RoutePattern, such as
RoutePattern.GET.
- Self Type
- RoutePattern[A]
- Alphabetic
- By Inheritance
- RoutePattern
- Serializable
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
->[Env, Context](middleware: HandlerAspect[Env, Context])(implicit zippable: Zippable[A, Context]): Builder[Env, Out]
Combines this route pattern with the specified middleware, which can be used to build a route by providing a handler.
-
def
->[Env, Err](handler: Handler[Env, Response, Request, Response])(implicit trace: Trace): Route[Env, Err]
Creates a route from this pattern and the specified handler, which ignores any parameters produced by this route pattern.
Creates a route from this pattern and the specified handler, which ignores any parameters produced by this route pattern. This method exists for performance reasons, as it avoids all overhead of propagating parameters or supporting contextual middleware.
-
def
->[Env, Err, I](handler: Handler[Env, Err, I, Response])(implicit zippable: RequestHandlerInput[A, I], trace: Trace): Route[Env, Err]
Creates a route from this pattern and the specified handler.
-
def
/[B](that: PathCodec[B])(implicit combiner: Combiner[A, B]): RoutePattern[Out]
Returns a new pattern that is extended with the specified segment pattern.
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
??(doc: Doc): RoutePattern[A]
Attaches documentation to the route pattern, which may be used when generating developer docs for a route.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
asType[B](implicit ev: =:=[A, B]): RoutePattern[B]
Reinteprets the type parameter, given evidence it is equal to some other type.
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @IntrinsicCandidate()
-
def
decode(actual: Method, path: Path): Either[String, A]
Decodes a method and path into a value of type
A. -
def
doc: Doc
Returns the documentation for the route pattern, if any.
-
def
encode(value: A): Either[String, (Method, Path)]
Encodes a value of type
Ainto the method and path that this route pattern would successfully match against. -
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
format(value: A): Either[String, Path]
Formats a value of type
Ainto a path.Formats a value of type
Ainto a path. This is useful for embedding paths into HTML that is rendered by the server. -
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
matches(method: Method, path: Path): Boolean
Determines if this pattern matches the specified method and path.
Determines if this pattern matches the specified method and path. Rather than use this method, you should just try to decode it directly, for higher performance, otherwise the same information will be decoded twice.
- val method: Method
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def nest(prefix: PathCodec[Unit]): RoutePattern[A]
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- val pathCodec: PathCodec[A]
-
def
render: String
Renders the route pattern as a string.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toHttpCodec: HttpCodec[codec.HttpCodecType.Path with codec.HttpCodecType.Method, A]
Converts the route pattern into an HttpCodec that produces the same value.
-
def
toString(): String
- Definition Classes
- RoutePattern → AnyRef → Any
-
def
unapply(tuple: (Method, Path)): Option[A]
This exists for use with Scala custom extractor syntax, allowing route patterns to match against and deconstruct tuples of methods and paths.
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )