api

http4k / org.http4k.core

Package org.http4k.core

The core abstractions for the http4k library.

Types

Name Summary
Accept data class Accept
Body If this Body is NOT being returned to the caller (via a Server implementation or otherwise), close() should be called.interface Body : Closeable
BodyMode BodyMode represents a choice between working lazily with streams or eagerly storing the body contents in memory.sealed class BodyMode : (InputStream) -> Body
ContentType data class ContentType
Credentials data class Credentials
Filter interface Filter : (HttpHandler) -> HttpHandler
Headers typealias Headers = Parameters
HttpHandler typealias HttpHandler = (Request) -> Response
HttpMessage HttpMessages are designed to be immutable, so any mutation methods return a modified copy of the message.interface HttpMessage : Closeable
HttpTransaction data class HttpTransaction
MemoryBody Represents a body that is backed by an in-memory ByteBuffer. Closing this has no effect.data class MemoryBody : Body
MemoryRequest data class MemoryRequest : Request
MemoryResponse data class MemoryResponse : Response
Method enum class Method
MimeTypes class MimeTypes
MultipartEntity sealed class MultipartEntity : Closeable
MultipartFormBody 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..data class MultipartFormBody : Body, Closeable
Parameters typealias Parameters = List<Parameter>
Request interface Request : HttpMessage
RequestContext class RequestContext
RequestContexts In-memory RequestContext store. Override the storeId to use multiple stores in one app.class RequestContexts : Store<RequestContext>
RequestSource data class RequestSource
Response interface Response : HttpMessage
Status class Status
Store interface Store<OUT> : LensInjector<OUT, Request>, LensExtractor<Request, OUT>
StreamBody Represents a body that is backed by a (lazy) InputStream. Operating with StreamBody has a number of potential gotchas:class StreamBody : Body
Uri data class Uri : Comparable<Uri>
UriTemplate data class UriTemplate

Extensions for External Classes

Name Summary
kotlin.collections.List  
kotlin.collections.Map  
kotlin.String  

Functions

Name Summary
<no name provided> fun <no name provided>(): Unit
alphabetiseHeaders fun <T : HttpMessage> T.alphabetiseHeaders(): T
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
removeQuery fun Uri.removeQuery(name: 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 Environment.with(vararg modifiers: (Environment) -> Environment): Environment
fun <T : HttpMessage> T.with(vararg modifiers: (T) -> T): T
fun WebForm.with(vararg modifiers: (WebForm) -> WebForm): WebForm
fun MultipartForm.with(vararg modifiers: (MultipartForm) -> MultipartForm): MultipartForm

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