http4k / org.http4k.core

Package org.http4k.core

The core abstractions for the http4k library.


Name Summary
Body interface Body : Closeable
If this Body is NOT being returned to the caller (via a Server implementation or otherwise), close() should be called.
BodyMode sealed class BodyMode : (InputStream) -> Body
ContentType data class ContentType
Credentials data class Credentials
Event interface Event
EventCategory data class EventCategory
Filter interface Filter : (HttpHandler) -> HttpHandler
FormFile data class FormFile : Closeable
HttpMessage interface HttpMessage : Closeable
HttpTransaction data class HttpTransaction
MemoryBody data class MemoryBody : Body
Represents a body that is backed by an in-memory ByteBuffer. Closing this has no effect.
MemoryRequest data class MemoryRequest : Request
MemoryResponse data class MemoryResponse : Response
Method enum class Method
MimeTypes data class MimeTypes
MultipartEntity sealed class MultipartEntity : Closeable
MultipartFormBody data class MultipartFormBody : Body, Closeable
Represents a Multi-part that is backed by a stream, which should be closed after handling the content. The gotchas which apply to StreamBody also apply here..
Request interface Request : HttpMessage
RequestContext class RequestContext
RequestContexts class RequestContexts : Store<RequestContext>
In-memory RequestContext store.
Response interface Response : HttpMessage
Status class Status
Store interface Store<OUT> : LensInjector<OUT, Request>, LensExtractor<Request, OUT>
StreamBody class StreamBody : Body
Represents a body that is backed by a (lazy) InputStream. Operating with StreamBody has a number of potential gotchas:
Uri data class Uri
UriTemplate data class UriTemplate

Type Aliases

Name Summary
Events typealias Events = (Event) -> Unit
Headers typealias Headers = Parameters
HttpHandler typealias HttpHandler = (Request) -> Response
Parameters typealias Parameters = List<Parameter>

Extensions for External Classes

Name Summary


Name Summary
authority fun Uri.authority(authority: Authority): Uri
fun Uri.authority(): Authority
extend fun Uri.extend(uri: Uri): Uri
host fun Uri.host(): Host
fun Uri.host(host: Host): Uri
maxAge fun Response.maxAge(duration: Duration): Response
multipartIterator fun HttpMessage.multipartIterator(): Iterator<MultipartEntity>
mustRevalidate fun Response.mustRevalidate(): Response
noCache fun Response.noCache(): Response
noStore fun Response.noStore(): Response
onlyIfCached fun Response.onlyIfCached(): Response
port fun Uri.port(port: Port?): Uri
fun Uri.port(): Port?
private fun Response.private(): Response
public fun Response.public(): Response
queries fun Uri.queries(): Parameters
query fun Uri.query(name: String, value: String?): Uri
staleIfError fun Response.staleIfError(duration: Duration): Response
staleWhileRevalidate fun Response.staleWhileRevalidate(duration: Duration): Response
then fun Filter.then(next: Filter): Filter
fun Filter.then(next: HttpHandler): HttpHandler
fun Filter.then(routingHttpHandler: RoutingHttpHandler): RoutingHttpHandler
toCurl fun Request.toCurl(truncateBodyLength: Int = 256): String
with fun <T> T.with(vararg modifiers: (T) -> T): T

Companion Object Properties

Name Summary
NoOp val Filter.Companion.NoOp: Filter

Companion Object Functions

Name Summary
parse fun Request.Companion.parse(request: String): Request
fun Response.Companion.parse(response: String): Response