api

http4k / org.http4k.routing / RoutingHttpHandler

RoutingHttpHandler

interface RoutingHttpHandler : Router, HttpHandler

Composite HttpHandler which can potentially service many different URL patterns. Should return a 404 Response if it cannot service a particular Request.

Note that generally there should be no reason for the API user to implement this interface over and above the implementations that already exist. The interface is public only because we have not found a way to hide it from the API user in an API-consistent manner.

Functions

Name Summary
withBasePath Returns a Router which prepends the passed base path to the logic determining the match().abstract fun withBasePath(new: String): RoutingHttpHandler
withFilter Returns a Router which applies the passed Filter to all received requests before servicing them.abstract fun withFilter(new: Filter): RoutingHttpHandler

Extension Functions

Name Summary
and infix fun Router.and(that: Router): Router
bind infix fun Router.bind(handler: HttpHandler): RoutingHttpHandler
infix fun Router.bind(handler: RoutingHttpHandler): RoutingHttpHandler
withChaosApi Mixin the set of remote Chaos API endpoints to a standard HttpHandler, using the passed ChaosStage. Optionally a Security can be passed to limit access to the chaos controls.fun RoutingHttpHandler.withChaosApi(engine: ChaosEngine = ChaosEngine(), security: Security = NoSecurity, controlsPath: String = "/chaos", openApiPath: String = "", corsPolicy: CorsPolicy = UnsafeGlobalPermissive, clock: Clock = Clock.systemUTC(), apiName: String = "http4k"): RoutingHttpHandler

Inheritors

Name Summary
ContractRoutingHttpHandler data class ContractRoutingHttpHandler : RoutingHttpHandler