api

http4k / org.http4k.lens / LensExtractor

LensExtractor

interface LensExtractor<in IN, out OUT> : (IN) -> OUT (source)

Functions

Name Summary
extract open fun extract(target: IN): OUT
Lens operation to get the value from the target. Synonym for invoke(IN)
get open operator fun <R : IN> get(target: R): OUT
Lens operation to get the value from the target. Synonym for invoke(IN)
invoke abstract operator fun invoke(target: IN): OUT
Lens operation to get the value from the target

Extension Functions

Name Summary
and infix fun Trigger.and(that: Trigger): Trigger
asFilter fun Stage.asFilter(): Filter
Converts this chaos behaviour to a standard http4k Filter.
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
not operator fun Trigger.not(): (Request) -> Boolean
or infix fun Trigger.or(that: Trigger): Trigger
renderToResponse fun TemplateRenderer.renderToResponse(viewModel: ViewModel, status: Status = OK, contentType: ContentType = TEXT_HTML): Response
Convenience method for generating a Response from a view model.
testWsClient fun WsHandler.testWsClient(request: Request): TestWsClient?
then fun Events.then(next: Events): Events
then fun TemplateRenderer.then(that: TemplateRenderer): TemplateRenderer
Compose a TemplateRenderer with another, so you can fall back.
then fun Stage.then(nextStage: Stage): Stage
Chain the next ChaosBehaviour to apply when this stage is finished.
until fun Stage.until(trigger: Trigger): Stage
Stop applying the ChaosBehaviour of this stage when the ChaosTrigger fires.
with fun <T> T.with(vararg modifiers: (T) -> T): T
withAsyncApi fun HttpHandler.withAsyncApi(): AsyncHttpClient
Convert a synchronous HttpHandler API to mimic AsyncHttpClient
withChaosControls fun HttpHandler.~~withChaosControls~~(stage: Stage = ChaosStages.Wait, security: Security = NoSecurity, controlsPath: String = "/chaos", openApiPath: String = "", corsPolicy: CorsPolicy = CorsPolicy.UnsafeGlobalPermissive): RoutingHttpHandler
withChaosEngine fun HttpHandler.withChaosEngine(stage: Stage = Wait, security: Security = NoSecurity, controlsPath: String = "/chaos", openApiPath: String = "", corsPolicy: CorsPolicy = UnsafeGlobalPermissive): RoutingHttpHandler
Convert a standard HttpHandler to be Chaos-enabled, using the passed ChaosStage. Optionally a Security can be passed to limit access to the chaos controls.

Inheritors

Name Summary
BodyLens open class BodyLens<out FINAL> : LensExtractor<HttpMessage, FINAL>
A BodyLens provides the uni-directional extraction of an entity from a target body.
Companion companion object Companion : LensExtractor<Request, UUID>, LensInjector<UUID, Request>
Lens open class Lens<in IN : Any, out FINAL> : LensExtractor<IN, FINAL>, Iterable<Meta>
A Lens provides the uni-directional extraction of an entity from a target.
Store interface Store<OUT> : LensInjector<OUT, Request>, LensExtractor<Request, OUT>
WsMessageLens open class WsMessageLens<out FINAL> : LensExtractor<WsMessage, FINAL>
A WsMessageLens provides the extraction of an entity from a target WsMessage.