Packages

p

sttp.tapir.server

interceptor

package interceptor

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. Protected

Package Members

  1. package content
  2. package cors
  3. package decodefailure
  4. package exception
  5. package log
  6. package metrics
  7. package reject

Type Members

  1. case class CustomiseInterceptors[F[_], O](createOptions: (CustomiseInterceptors[F, O]) => O, prependedInterceptors: List[Interceptor[F]] = Nil, metricsInterceptor: Option[MetricsRequestInterceptor[F]] = None, corsInterceptor: Option[CORSInterceptor[F]] = None, rejectHandler: Option[RejectHandler[F]] = Some(DefaultRejectHandler[F]), exceptionHandler: Option[ExceptionHandler[F]] = Some(DefaultExceptionHandler[F]), serverLog: Option[ServerLog[F]] = None, notAcceptableInterceptor: Option[NotAcceptableInterceptor[F]] = Some(new NotAcceptableInterceptor[F]()), additionalInterceptors: List[Interceptor[F]] = Nil, decodeFailureHandler: DecodeFailureHandler = DefaultDecodeFailureHandler.default, appendedInterceptors: List[Interceptor[F]] = Nil) extends Product with Serializable

    Allows customising the interceptors used by the server interpreter.

    Allows customising the interceptors used by the server interpreter. Custom interceptors can be added via addInterceptor, sitting between two configurable, default interceptor groups.

    The order of the interceptors corresponds to the ordering of the parameters.

    Moreover, built-in interceptors can be customised or disabled. Once done, use .options to obtain the server interpreter options to use.

    prependedInterceptors

    Additional interceptors, which will be called first on request / last on response, e.g. performing logging, metrics, or providing alternate responses.

    metricsInterceptor

    Whether to collect metrics.

    rejectHandler

    How to respond when decoding fails for all interpreted endpoints.

    exceptionHandler

    Whether to respond to exceptions in the server logic, or propagate them to the server.

    serverLog

    The server log using which an interceptor will be created, if any.

    notAcceptableInterceptor

    Whether to return 406 (not acceptable) if there's no body in the endpoint's outputs, which can satisfy the constraints from the Accept header.

    additionalInterceptors

    Additional interceptors, which will be called before (on request) / after (on response) the decodeFailureHandler one, e.g. performing logging, metrics, or providing alternate responses.

    decodeFailureHandler

    The decode failure handler, from which an interceptor will be created. Determines whether to respond when an input fails to decode.

    appendedInterceptors

    Additional interceptors, which will be called last on request / first on response, e.g. handling decode failures, or providing alternate responses.

  2. case class DecodeFailureContext(endpoint: AnyEndpoint, failingInput: EndpointInput[_], failure: Failure, request: ServerRequest) extends Product with Serializable
  3. case class DecodeSuccessContext[F[_], A, U, I](serverEndpoint: Full[A, U, I, _, _, _, F], securityInput: A, principal: U, input: I, request: ServerRequest) extends Product with Serializable
  4. trait EndpointHandler[F[_], B] extends AnyRef

    Handles the result of decoding a request using an endpoint's inputs.

  5. trait EndpointInterceptor[F[_]] extends Interceptor[F]

    Allows intercepting the handling of a request by an endpoint, when either the endpoint's inputs have been decoded successfully, or when decoding has failed.

    Allows intercepting the handling of a request by an endpoint, when either the endpoint's inputs have been decoded successfully, or when decoding has failed. Ultimately, when all interceptors are run, the endpoint's server logic will be run (in case of a decode success), or None will be returned (in case of decode failure).

    Instead of calling the nested behavior, alternative responses can be returned using the responder.

  6. sealed trait Interceptor[F[_]] extends AnyRef

    Intercepts requests, and endpoint decode events.

    Intercepts requests, and endpoint decode events. Using interceptors it's possible to:

    • customise the request that is passed downstream
    • short-circuit further processing and provide an alternate (or no) response
    • replace or modify the response that is sent back to the client

    Interceptors can be called when the request is started to be processed (use RequestInterceptor in this case), or for each endpoint, with either input success of failure decoding events (see EndpointInterceptor).

    To add an interceptors, modify the server options of the server interpreter.

    F

    The effect type constructor.

  7. trait RequestHandler[F[_], R, B] extends AnyRef
  8. trait RequestInterceptor[F[_]] extends Interceptor[F]

    Allows intercepting the handling of request, before decoding using any of the endpoints is done.

    Allows intercepting the handling of request, before decoding using any of the endpoints is done. The request can be modified, before invoking further behavior, passed through requestHandler. Ultimately, when all interceptors are run, logic decoding subsequent endpoint inputs will be run.

    A request interceptor is called once for a request.

    Instead of calling the nested behavior, alternative responses can be returned using the responder.

    Moreover, when calling requestHandler, an EndpointInterceptor can be provided, which will be added to the list of endpoint interceptors to call. The order in which the endpoint interceptors will be called will correspond to their order in the interceptors list in the server options. An "empty" interceptor can be provided using EndpointInterceptor.noop.

    F

    The effect type constructor.

  9. sealed trait RequestResult[+B] extends AnyRef

    The result of processing a request: either a response, or a list of endpoint decoding failures.

  10. trait Responder[F[_], B] extends AnyRef
  11. case class SecurityFailureContext[F[_], A](serverEndpoint: Full[A, _, _, _, _, _, F], securityInput: A, request: ServerRequest) extends Product with Serializable

Ungrouped