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]
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. RoutePattern
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new RoutePattern(method: Method, pathCodec: PathCodec[A])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. 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.

  4. 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.

  5. 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.

  6. def /[B](that: PathCodec[B])(implicit combiner: Combiner[A, B]): RoutePattern[Out]

    Returns a new pattern that is extended with the specified segment pattern.

  7. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. def ??(doc: Doc): RoutePattern[A]

    Attaches documentation to the route pattern, which may be used when generating developer docs for a route.

  9. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  10. def asType[B](implicit ev: =:=[A, B]): RoutePattern[B]

    Reinteprets the type parameter, given evidence it is equal to some other type.

  11. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @IntrinsicCandidate()
  12. def decode(actual: Method, path: Path): Either[String, A]

    Decodes a method and path into a value of type A.

  13. def doc: Doc

    Returns the documentation for the route pattern, if any.

  14. def encode(value: A): Either[String, (Method, Path)]

    Encodes a value of type A into the method and path that this route pattern would successfully match against.

  15. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. def format(value: A): Either[String, Path]

    Formats a value of type A into a path.

    Formats a value of type A into a path. This is useful for embedding paths into HTML that is rendered by the server.

  17. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. 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.

  20. val method: Method
  21. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  22. def nest(prefix: PathCodec[Unit]): RoutePattern[A]
  23. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  24. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  25. val pathCodec: PathCodec[A]
  26. def render: String

    Renders the route pattern as a string.

  27. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  28. def toHttpCodec: HttpCodec[codec.HttpCodecType.Path with codec.HttpCodecType.Method, A]

    Converts the route pattern into an HttpCodec that produces the same value.

  29. def toString(): String
    Definition Classes
    RoutePattern → AnyRef → Any
  30. 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.

  31. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  33. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] ) @Deprecated
    Deprecated

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped