final case class HandlerAspect[-Env, +CtxOut](protocol: ProtocolStack[Env, Request, (Request, CtxOut), Response, Response]) extends Middleware[Env] with Product with Serializable

A zio.http.HandlerAspect is a kind of zio.http.ProtocolStack that is specialized to transform a handler's incoming requests and outgoing responses. Each layer in the stack corresponds to a separate transformation.

Layers may incorporate layer-specific information into a generic type parameter, referred to as middleware context, which composes using tupling.

Layers may also be stateful at the level of each transformation application. So, for example, a layer that is timing request durations may capture the start time of the request in the incoming interceptor, and pass this state to the outgoing interceptor, which can then compute the duration.

zio.http.HandlerAspect is more than just a wrapper around zio.http.ProtocolStack, as its concatenation operator has been specialized to entuple contexts, so that each layer may only add context to the contextual output.

Self Type
HandlerAspect[Env, CtxOut]
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. HandlerAspect
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. Middleware
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new HandlerAspect(protocol: ProtocolStack[Env, Request, (Request, CtxOut), Response, Response])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def ++[Env1 <: Env, CtxOut2](that: HandlerAspect[Env1, CtxOut2])(implicit zippable: Zippable[CtxOut, CtxOut2]): HandlerAspect[Env1, Out]

    Combines this middleware with the specified middleware sequentially, such that this middleware will be applied first on incoming requests, and last on outgoing responses, and the specified middleware will be applied last on incoming requests, and first on outgoing responses.

    Combines this middleware with the specified middleware sequentially, such that this middleware will be applied first on incoming requests, and last on outgoing responses, and the specified middleware will be applied last on incoming requests, and first on outgoing responses. Context from both middleware will be combined using tuples.

  4. def ++[UpperEnv1 <: Env](that: Middleware[UpperEnv1]): Middleware[UpperEnv1]
    Definition Classes
    Middleware
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. def @@[UpperEnv1 <: Env](that: Middleware[UpperEnv1]): Middleware[UpperEnv1]
    Definition Classes
    Middleware
  7. def apply[Env1 <: Env, Err](routes: Routes[Env1, Err]): Routes[Env1, Err]

    Applies middleware to the specified handler, which may ignore the context produced by this middleware.

    Applies middleware to the specified handler, which may ignore the context produced by this middleware.

    Definition Classes
    HandlerAspectMiddleware
  8. def applyHandler[Env1 <: Env](handler: RequestHandler[Env1, Response]): RequestHandler[Env1, Response]
  9. def applyHandlerContext[Env1 <: Env](handler: Handler[Env1, Response, (CtxOut, Request), Response]): Handler[Env1, Response, Request, Response]

    Applies middleware to the specified handler, which must process the context produced by this middleware.

  10. def as[CtxOut2](ctxOut2: ⇒ CtxOut2): HandlerAspect[Env, CtxOut2]

    Returns new middleware that transforms the context of the middleware to the specified constant.

  11. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  12. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @IntrinsicCandidate()
  13. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. def map[CtxOut2](f: (CtxOut) ⇒ CtxOut2): HandlerAspect[Env, CtxOut2]

    Returns new middleware that transforms the context of the middleware using the specified function.

  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  20. val protocol: ProtocolStack[Env, Request, (Request, CtxOut), Response, Response]
  21. def provideEnvironment(env: ZEnvironment[Env]): HandlerAspect[Any, CtxOut]

    Returns new middleware that fully provides the specified environment to this middleware, resulting in middleware that has no contextual dependencies.

  22. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  23. def unit: HandlerAspect[Env, Unit]

    Returns new middleware that produces the unit value as its context.

  24. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  26. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. def when(condition: (Request) ⇒ Boolean): HandlerAspect[Env, Unit]

    Conditionally applies this middleware to the specified handler, based on the result of the predicate applied to the incoming request.

  28. def whenHeader(condition: (Headers) ⇒ Boolean): HandlerAspect[Env, Unit]

    Conditionally applies this middleware to the specified handler, based on the result of the predicate applied to the incoming request's headers.

  29. def whenZIO[Env1 <: Env](condition: (Request) ⇒ ZIO[Env1, Response, Boolean]): HandlerAspect[Env1, Unit]

    Conditionally applies this middleware to the specified handler, based on the result of the effectful predicate applied to the incoming request.

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 Middleware[Env]

Inherited from AnyRef

Inherited from Any

Ungrouped