Handler

zio.http.Handler$
See theHandler companion trait
object Handler

Attributes

Companion:
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Handler.type

Members list

Concise view

Type members

Classlikes

final class ContraFlatMap[-R, +Err, -In, +Out, In1](val self: Handler[R, Err, In, Out]) extends AnyVal

Attributes

Graph
Supertypes
class AnyVal
trait Matchable
class Any
final implicit class FastZIOSyntax[R, E, A](val zio: ZIO[R, E, A]) extends AnyVal

Attributes

Graph
Supertypes
class AnyVal
trait Matchable
class Any
final class FromFunction[In](val self: Unit) extends AnyVal

Attributes

Graph
Supertypes
class AnyVal
trait Matchable
class Any
final class FromFunctionExit[In](val self: Unit) extends AnyVal

Attributes

Graph
Supertypes
class AnyVal
trait Matchable
class Any
final class FromFunctionHandler[In](val self: Unit) extends AnyVal

Attributes

Graph
Supertypes
class AnyVal
trait Matchable
class Any
final class FromFunctionZIO[In](val self: Unit) extends AnyVal

Attributes

Graph
Supertypes
class AnyVal
trait Matchable
class Any
final implicit class RequestHandlerSyntax[-R, +Err](val self: RequestHandler[R, Err]) extends HeaderModifierZIO[RequestHandler[R, Err]]

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
final implicit class ResponseOutputSyntax[-R, +Err, -In](val self: Handler[R, Err, In, Response]) extends AnyVal

Attributes

Graph
Supertypes
class AnyVal
trait Matchable
class Any

Value members

Concrete methods

def attempt[Out](out: => Out): Handler[Any, Throwable, Any, Out]

Attempts to create a Handler that succeeds with the provided value, capturing all exceptions on it's way.

Attempts to create a Handler that succeeds with the provided value, capturing all exceptions on it's way.

Attributes

def badRequest(message: String): Handler[Any, Nothing, Any, Response]

Creates a handler which always responds with a 400 status code.

Creates a handler which always responds with a 400 status code.

Attributes

def die(failure: => Throwable): Handler[Any, Nothing, Any, Nothing]

Returns a handler that dies with the specified Throwable. This method can be used for terminating an app because a defect has been detected in the code. Terminating a handler leads to aborting handling of an HTTP request and responding with 500 Internal Server Error.

Returns a handler that dies with the specified Throwable. This method can be used for terminating an app because a defect has been detected in the code. Terminating a handler leads to aborting handling of an HTTP request and responding with 500 Internal Server Error.

Attributes

def dieMessage(message: => String): Handler[Any, Nothing, Any, Nothing]

Returns an app that dies with a RuntimeException having the specified text message. This method can be used for terminating a HTTP request because a defect has been detected in the code.

Returns an app that dies with a RuntimeException having the specified text message. This method can be used for terminating a HTTP request because a defect has been detected in the code.

Attributes

def error(error: HttpError): Handler[Any, Nothing, Any, Response]

Creates a handler with HttpError.

Creates a handler with HttpError.

Attributes

def error(message: String): Handler[Any, Nothing, Any, Response]

Creates a handler that responds with 500 status code

Creates a handler that responds with 500 status code

Attributes

def fail[Err](err: => Err): Handler[Any, Err, Any, Nothing]

Creates a Handler that always fails

Creates a Handler that always fails

Attributes

def failCause[Err](cause: => Cause[Err]): Handler[Any, Err, Any, Nothing]
def forbidden(message: String): Handler[Any, Nothing, Any, Response]

Creates a handler that responds with 403 - Forbidden status code

Creates a handler that responds with 403 - Forbidden status code

Attributes

def fromBody(body: Body): Handler[Any, Nothing, Any, Response]

Creates a handler which always responds the provided data and a 200 status code

Creates a handler which always responds the provided data and a 200 status code

Attributes

def fromEither[Err, Out](either: Either[Err, Out]): Handler[Any, Err, Any, Out]

Lifts an Either into a Handler alue.

Lifts an Either into a Handler alue.

Attributes

def fromExit[Err, Out](exit: => Exit[Err, Out]): Handler[Any, Err, Any, Out]

Creates a Handler from a pure function

Creates a Handler from a pure function

Attributes

Creates a Handler from an pure function from A to HExit[R,E,B]

Creates a Handler from an pure function from A to HExit[R,E,B]

Attributes

Creates a Handler from an effectful pure function

Creates a Handler from an effectful pure function

Attributes

def fromHttp[R, Err, In, Out](http: Http[R, Err, In, Out], default: Handler[R, Err, In, Out])(implicit trace: Trace): Handler[R, Err, In, Out]
def fromStream[R](stream: ZStream[R, Throwable, String], charset: Charset)(implicit trace: Trace): Handler[R, Throwable, Any, Response]

Creates a Handler that always succeeds with a 200 status code and the provided ZStream as the body

Creates a Handler that always succeeds with a 200 status code and the provided ZStream as the body

Attributes

def fromStream[R](stream: ZStream[R, Throwable, Byte])(implicit trace: Trace): Handler[R, Throwable, Any, Response]

Creates a Handler that always succeeds with a 200 status code and the provided ZStream as the body

Creates a Handler that always succeeds with a 200 status code and the provided ZStream as the body

Attributes

def fromZIO[R, Err, Out](zio: => ZIO[R, Err, Out]): Handler[R, Err, Any, Out]

Converts a ZIO to a Handler type

Converts a ZIO to a Handler type

Attributes

def getResource(path: String)(implicit trace: Trace): Handler[Any, Throwable, Any, URL]

Attempts to retrieve files from the classpath.

Attempts to retrieve files from the classpath.

Attributes

def getResourceAsFile(path: String)(implicit trace: Trace): Handler[Any, Throwable, Any, File]

Attempts to retrieve files from the classpath.

Attempts to retrieve files from the classpath.

Attributes

def html(view: Html): Handler[Any, Nothing, Any, Response]

Creates a handler which always responds with the provided Html page.

Creates a handler which always responds with the provided Html page.

Attributes

def identity[A]: Handler[Any, Nothing, A, A]

Creates a pass thru Handler instance

Creates a pass thru Handler instance

Attributes

def methodNotAllowed(message: String): Handler[Any, Nothing, Any, Response]

Creates a handler which always responds with a 405 status code.

Creates a handler which always responds with a 405 status code.

Attributes

def notFound: Handler[Any, Nothing, Request, Response]

Creates a handler that fails with a NotFound exception.

Creates a handler that fails with a NotFound exception.

Attributes

def ok: Handler[Any, Nothing, Any, Response]

Creates a handler which always responds with a 200 status code.

Creates a handler which always responds with a 200 status code.

Attributes

def response(response: Response): Handler[Any, Nothing, Any, Response]

Creates a handler which always responds with the same value.

Creates a handler which always responds with the same value.

Attributes

def responseZIO[R, Err](getResponse: ZIO[R, Err, Response]): Handler[R, Err, Any, Response]

Converts a ZIO to a handler type

Converts a ZIO to a handler type

Attributes

def stackTrace(implicit trace: Trace): Handler[Any, Nothing, Any, StackTrace]
def status(code: Status): Handler[Any, Nothing, Any, Response]

Creates a handler which always responds with the same status code and empty data.

Creates a handler which always responds with the same status code and empty data.

Attributes

def succeed[Out](out: Out): Handler[Any, Nothing, Any, Out]

Creates a Handler that always returns the same response and never fails.

Creates a Handler that always returns the same response and never fails.

Attributes

def template(heading: CharSequence)(view: Html): Handler[Any, Nothing, Any, Response]

Creates a handler which responds with an Html page using the built-in template.

Creates a handler which responds with an Html page using the built-in template.

Attributes

def text(text: CharSequence): Handler[Any, Nothing, Any, Response]

Creates a handler which always responds with the same plain text.

Creates a handler which always responds with the same plain text.

Attributes

def timeout(duration: Duration)(implicit trace: Trace): Handler[Any, Nothing, Any, Response]

Creates a handler that responds with a 408 status code after the provided time duration

Creates a handler that responds with a 408 status code after the provided time duration

Attributes

def tooLarge: Handler[Any, Nothing, Any, Response]

Creates a handler which always responds with a 413 status code.

Creates a handler which always responds with a 413 status code.

Attributes

Implicits

Implicits

final implicit def FastZIOSyntax[R, E, A](zio: ZIO[R, E, A]): FastZIOSyntax[R, E, A]
final implicit def RequestHandlerSyntax[R, Err](self: RequestHandler[R, Err]): RequestHandlerSyntax[R, Err]
final implicit def ResponseOutputSyntax[R, Err, In](self: Handler[R, Err, In, Response]): ResponseOutputSyntax[R, Err, In]