Object/Trait

uzhttp

Response

Related Docs: trait Response | package uzhttp

Permalink

object Response

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Response
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. final case class PathResponse extends Response with Product with Serializable

    Permalink
  2. class PermanentCache extends PartialFunction[Request, IO[HTTPError, Response]]

    Permalink

    A cache that memoizes responses for eligible requests, and can cache response bodies of eligible responses

  3. final case class WebsocketResponse extends Response with Product with Serializable

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. object PermanentCache

    Permalink
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def const(body: Array[Byte], status: Status = Status.Ok, contentType: String = "application/octet-stream", headers: List[(String, String)] = Nil): Response

    Permalink
  8. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. def fromInputStream(stream: ZManaged[Blocking, Throwable, InputStream], size: Long, contentType: String = "application/octet-stream", status: Status = Status.Ok, headers: List[(String, String)] = Nil): UIO[Response]

    Permalink
  12. def fromPath(path: Path, request: Request, contentType: String = "application/octet-stream", status: Status = Status.Ok, headers: List[(String, String)] = Nil): ZIO[Blocking, Throwable, Response]

    Permalink

    Read a response from a path.

    Read a response from a path. Uses blocking I/O, so that a file on the local filesystem can be directly transferred to the connection using OS-level primitives when possible.

    Note that you mustn't use this method if the response may be cached, as (depending on the request) it may produce a 304 Not Modified response. You don't want that being served to other clients! Use

    path

    A Path pointing to the file on the filesystem.

    request

    The request to respond to. This is used:

    • To check if the If-Modified-Since header value included in the request for this file. If given (in RFC 1123 format), an attempt will be made to determine if the file has been modified since the requested timestamp. If it hasn't, then the response returned will be a 304 Not Modified response with no body.
    • To provide the URI for a NotFound error, in case the path does not exist.
    contentType

    The Content-Type header to use for the response. Defaults to application/octet-stream.

    status

    The status of the response. Defaults to Ok (HTTP 200)

    headers

    Any additional headers to include in the response.

    returns

    A ZIO value which, when evaluated, will attempt to locate the given resource and provide an appropriate Response. If the resource isn't present, it will fail with HTTPError.NotFound. Since this response interacts with the filesystem, it can fail with other arbitrary Throwable failures; you'll probably need to catch these and convert them to HTTPError failures.

  13. def fromResource(name: String, request: Request, classLoader: ClassLoader = getClass.getClassLoader, contentType: String = "application/octet-stream", status: Status = Status.Ok, headers: List[(String, String)] = Nil): ZIO[Blocking, Throwable, Response]

    Permalink

    Read a response from a resource.

    Read a response from a resource. Uses blocking I/O, so that a file on the local filesystem can be directly transferred to the connection using OS-level primitives when possible.

    name

    The name (path) of the resource

    request

    The request to respond to. This is used:

    • To check if the If-Modified-Since header value included in the request for this file. If given (in RFC 1123 format), an attempt will be made to determine if the file has been modified since the requested timestamp. If it hasn't, then the response returned will be a 304 Not Modified response with no body.
    • To provide the URI for a NotFound error, in case the path does not exist.
    classLoader

    The class loader which can find the resource (defaults to this class's class loader)

    contentType

    The Content-Type header to use for the response. Defaults to application/octet-stream.

    status

    The status of the response. Defaults to Ok (HTTP 200)

    headers

    Any additional headers to include in the response.

    returns

    A ZIO value which, when evaluated, will attempt to locate the given resource and provide an appropriate Response. If the resource isn't present, it will fail with HTTPError.NotFound. Since this response interacts with the filesystem, it can fail with other arbitrary Throwable failures; you'll probably need to catch these and convert them to HTTPError failures.

  14. def fromStream(stream: Stream[Nothing, Chunk[Byte]], size: Long, contentType: String = "application/octet-stream", status: Status = Status.Ok, ifModifiedSince: Option[String] = None, headers: List[(String, String)] = Nil): UIO[Response]

    Permalink
  15. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  16. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  17. def html(body: String, status: Status = Status.Ok, headers: List[(String, String)] = Nil, charset: Charset = StandardCharsets.UTF_8): Response

    Permalink
  18. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  19. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  20. lazy val notModified: Response

    Permalink
  21. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  22. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  23. def permanentCache: Builder[Blocking]

    Permalink

    Build a caching layer which can memoize and cache responses in memory for the duration of the server's lifetime.

  24. def plain(body: String, status: Status = Status.Ok, headers: List[(String, String)] = Nil, charset: Charset = StandardCharsets.UTF_8): Response

    Permalink
  25. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  26. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  27. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. def websocket(req: Request, output: Stream[Throwable, Frame], headers: List[(String, String)] = Nil): IO[BadRequest, WebsocketResponse]

    Permalink

    Start a websocket request from a stream of uzhttp.websocket.Frames.

    Start a websocket request from a stream of uzhttp.websocket.Frames.

    req

    The websocket request that initiated this response.

    output

    A stream of websocket uzhttp.websocket.Frames to be sent to the client.

    headers

    Any additional headers to include in the response.

Inherited from AnyRef

Inherited from Any

Ungrouped