api

http4k / org.http4k.contract / ContractRoutingHttpHandler

ContractRoutingHttpHandler

data class ContractRoutingHttpHandler : RoutingHttpHandler (source)

Constructors

Name Summary
<init> ContractRoutingHttpHandler(renderer: ContractRenderer, security: Security, descriptionPath: String, preFlightExtraction: PreFlightExtraction, routes: List<ContractRoute> = emptyList(), rootAsString: String = "", preSecurityFilter: Filter = Filter.NoOp, postSecurityFilter: Filter = Filter.NoOp, includeDescriptionRoute: Boolean = false)

Functions

Name Summary
invoke fun invoke(request: Request): Response
match fun match(request: Request): HttpHandler?
Attempt to supply an HttpHandler which can service the passed request.
toString fun toString(): String
withBasePath fun withBasePath(new: String): ContractRoutingHttpHandler
Returns a RoutingHttpHandler which prepends the passed base path to the logic determining the match() To follow the trend of immutability, this will generally be a new instance.
withFilter fun withFilter(new: Filter): ContractRoutingHttpHandler
NOTE: By default, filters for Contracts are applied before the Security filter. Use withPostSecurityFilter() to achieve population of filters after security.
withPostSecurityFilter fun withPostSecurityFilter(new: Filter): ContractRoutingHttpHandler

Extension Functions

Name Summary
asK8sServer fun HttpHandler.asK8sServer(serverConfig: (port: Int) -> ServerConfig, port: Int = 8000, healthApp: HttpHandler = Health(), healthPort: Int = 8001): Http4kK8sServer
fun HttpHandler.asK8sServer(serverConfig: (port: Int) -> ServerConfig, env: Environment = ENV, healthApp: HttpHandler = Health()): Http4kK8sServer
asServer fun HttpHandler.asServer(fn: (Int) -> ServerConfig, port: Port): Http4kServer
fun HttpHandler.asServer(config: ServerConfig): Http4kServer
asServlet fun HttpHandler.asServlet(): HttpHandlerServlet
with fun <T> T.with(vararg modifiers: (T) -> T): T
withAsyncApi fun HttpHandler.withAsyncApi(): AsyncHttpClient
Convert a synchronous HttpHandler API to mimic AsyncHttpClient