Handler

zio.http.Handler
See theHandler companion trait

Attributes

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

Members list

Type members

Classlikes

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

Attributes

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

Attributes

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

Attributes

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

Attributes

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

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
object IsRequest

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
IsRequest.type
sealed trait IsRequest[-A]

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
final class ParamExtractorBuilder[A](val unit: Unit) extends AnyVal

Attributes

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

Attributes

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

Attributes

Supertypes
class AnyVal
trait Matchable
class Any

Value members

Concrete methods

def asChunkBounded(request: Request, limit: Int)(implicit trace: Trace): Handler[Any, Throwable, Any, Chunk[Byte]]
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: 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 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 handler 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 handler 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 handler 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 handler 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(status: => Error): Handler[Any, Nothing, Any, Response]

Creates a handler with an error and the default error message.

Creates a handler with an error and the default error message.

Attributes

def error(status: => Error, message: => String): Handler[Any, Nothing, Any, Response]

Creates a handler with an error and the specified error message.

Creates a handler with an error and the specified error message.

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 firstSuccessOf[R, Err, In, Out](handlers: NonEmptyChunk[Handler[R, Err, In, Out]], isRecoverable: Cause[Err] => Boolean)(implicit trace: Trace): Handler[R, Err, In, Out]
def forbidden: 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 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 from[H](handler: => H)(implicit h: ToHandler[H]): Handler[Env, Err, In, Out]
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]
def fromFile[R](makeFile: => File)(implicit trace: Trace): Handler[R, Throwable, Any, Response]
def fromFileZIO[R](getFile: ZIO[R, Throwable, File])(implicit trace: Trace): Handler[R, Throwable, Any, Response]
def fromFunction[In]: FromFunction[In]

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 fromResponse(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 fromResponseZIO[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 fromStream[R](stream: ZStream[R, Throwable, String], contentLength: Long, 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 with a known content length as the body

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

Attributes

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

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

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

Attributes

def fromStreamChunked[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 using chunked transfer encoding

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

Attributes

def fromStreamChunked[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 using chunked transfer encoding

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

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 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 internalServerError: Handler[Any, Nothing, Any, Response]
def internalServerError(message: => String): Handler[Any, Nothing, Any, Response]
def methodNotAllowed: 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 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 notFound(message: => String): Handler[Any, Nothing, Any, Response]
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

Creates a builder that can be used to create a handler that projects some component from its input. This is useful when created nested or monadic handlers, which require the input to all handlers be unified. By created extractors, the "smaller" handlers can extract what they need from the input to the "biggest" handler.

Creates a builder that can be used to create a handler that projects some component from its input. This is useful when created nested or monadic handlers, which require the input to all handlers be unified. By created extractors, the "smaller" handlers can extract what they need from the input to the "biggest" handler.

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

final def webSocket[Env](f: WebSocketChannel => ZIO[Env, Throwable, Any]): WebSocketApp[Env]

Constructs a handler from a function that uses a web socket.

Constructs a handler from a function that uses a web socket.

Attributes

Inherited methods

def fromResource(path: String)(implicit trace: Trace): Handler[Any, Throwable, Any, Response]

Attributes

Inherited from:
HandlerPlatformSpecific

Concrete fields

val unit: Handler[Any, Nothing, Any, Unit]

Implicits

Implicits

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]