final case class HttpApp[-Env](routes: Routes[Env, Response]) extends PartialFunction[Request, ZIO[Env, Response, Response]] with Product with Serializable
An HTTP application is a collection of routes, all of whose errors have been handled through conversion into HTTP responses.
HTTP applications can be installed into a zio.http.Server, which is capable of using them to serve requests.
- Self Type
- HttpApp[Env]
- Annotations
- @deprecated
- Deprecated
(Since version 3.0.0-RC7) Use Routes instead. Will be removed in the next release.
- Alphabetic
- By Inheritance
- HttpApp
- Serializable
- Serializable
- Product
- Equals
- PartialFunction
- Function1
- 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
++[Env1 <: Env](that: HttpApp[Env1]): HttpApp[Env1]
Combines this HTTP application with the specified HTTP application.
Combines this HTTP application with the specified HTTP application. In case of route conflicts, the routes in this HTTP application take precedence over the routes in the specified HTTP application.
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
@@[Env1 <: Env](aspect: Middleware[Env1]): HttpApp[Env1]
Applies the specified route aspect to every route in the HTTP application.
-
def
andThen[C](k: (ZIO[Env, Response, Response]) ⇒ C): PartialFunction[Request, C]
- Definition Classes
- PartialFunction → Function1
-
def
apply(request: Request): ZIO[Env, Response, Response]
Executes the HTTP application with the specified request input, returning an effect that will either succeed or fail with a Response.
Executes the HTTP application with the specified request input, returning an effect that will either succeed or fail with a Response.
- Definition Classes
- HttpApp → Function1
-
def
applyOrElse[A1 <: Request, B1 >: ZIO[Env, Response, Response]](x: A1, default: (A1) ⇒ B1): B1
- Definition Classes
- PartialFunction
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @IntrinsicCandidate()
-
def
compose[A](g: (A) ⇒ Request): (A) ⇒ ZIO[Env, Response, Response]
- Definition Classes
- Function1
- Annotations
- @unspecialized()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
-
def
isDefinedAt(request: Request): Boolean
Checks to see if the HTTP application may be defined at the specified request input.
Checks to see if the HTTP application may be defined at the specified request input. Note that it is still possible for an HTTP application to return a 404 Not Found response, which cannot be detected by this method. This method only checks for the presence of a handler that handles the method and path of the specified request.
- Definition Classes
- HttpApp → PartialFunction
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
lift: (Request) ⇒ Option[ZIO[Env, Response, Response]]
- Definition Classes
- PartialFunction
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
-
def
orElse[A1 <: Request, B1 >: ZIO[Env, Response, Response]](that: PartialFunction[A1, B1]): PartialFunction[A1, B1]
- Definition Classes
- PartialFunction
-
def
provideEnvironment(env: ZEnvironment[Env]): HttpApp[Any]
Provides the specified environment to the HTTP application, returning a new HTTP application that has no environmental requirements.
- val routes: Routes[Env, Response]
- def run(method: Method = Method.GET, path: Path = Path.root, headers: Headers = Headers.empty, body: Body = Body.empty): ZIO[Env, Nothing, Response]
-
def
runWith[U](action: (ZIO[Env, Response, Response]) ⇒ U): (Request) ⇒ Boolean
- Definition Classes
- PartialFunction
-
def
runZIO(request: Request): ZIO[Env, Nothing, Response]
An alias for
apply. -
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
timeout(duration: zio.Duration)(implicit trace: Trace): HttpApp[Env]
Returns a new HTTP application whose requests will be timed out after the specified duration elapses.
-
val
toHandler: Handler[Env, Nothing, Request, Response]
Converts the HTTP application into a request handler.
-
def
toString(): String
- Definition Classes
- Function1 → AnyRef → Any
-
def
tree(implicit trace: Trace): Tree[Env]
Accesses the underlying tree that provides fast dispatch to handlers.
-
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( ... )