A cache that memoizes responses for eligible requests, and can cache response bodies of eligible responses
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
A Path pointing to the file on the filesystem.
The request to respond to. This is used:
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.The Content-Type
header to use for the response. Defaults to application/octet-stream
.
The status of the response. Defaults to Ok
(HTTP 200)
Any additional headers to include in the response.
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.
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.
The name (path) of the resource
The request to respond to. This is used:
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.The class loader which can find the resource (defaults to this class's class loader)
The Content-Type
header to use for the response. Defaults to application/octet-stream
.
The status of the response. Defaults to Ok
(HTTP 200)
Any additional headers to include in the response.
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.
Build a caching layer which can memoize and cache responses in memory for the duration of the server's lifetime.
Start a websocket request from a stream of uzhttp.websocket.Frames.
Start a websocket request from a stream of uzhttp.websocket.Frames.
The websocket request that initiated this response.
A stream of websocket uzhttp.websocket.Frames to be sent to the client.
Any additional headers to include in the response.