Packages

c

sttp.tapir.server.interceptor

CustomiseInterceptors

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. 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.

Linear Supertypes
Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CustomiseInterceptors
  2. Serializable
  3. Product
  4. Equals
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new CustomiseInterceptors(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)

    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.

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def addInterceptor(i: Interceptor[F]): CustomiseInterceptors[F, O]
  5. val additionalInterceptors: List[Interceptor[F]]
  6. def appendInterceptor(i: Interceptor[F]): CustomiseInterceptors[F, O]
  7. val appendedInterceptors: List[Interceptor[F]]
  8. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  10. def corsInterceptor(c: Option[CORSInterceptor[F]]): CustomiseInterceptors[F, O]
  11. def corsInterceptor(c: CORSInterceptor[F]): CustomiseInterceptors[F, O]
  12. val corsInterceptor: Option[CORSInterceptor[F]]
  13. val createOptions: (CustomiseInterceptors[F, O]) => O
  14. def decodeFailureHandler(d: DecodeFailureHandler): CustomiseInterceptors[F, O]
  15. val decodeFailureHandler: DecodeFailureHandler
  16. def defaultHandlers(errorMessageOutput: (String) => ValuedEndpointOutput[_], notFoundWhenRejected: Boolean = false): CustomiseInterceptors[F, O]

    Use the default exception, decode failure and reject handlers.

    Use the default exception, decode failure and reject handlers.

    errorMessageOutput

    customise the way error messages are shown in error responses

    notFoundWhenRejected

    return a 404 formatted using errorMessageOutput when the request was rejected by all endpoints, instead of propagating the rejection to the server library

  17. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. def exceptionHandler(e: Option[ExceptionHandler[F]]): CustomiseInterceptors[F, O]
  19. def exceptionHandler(e: ExceptionHandler[F]): CustomiseInterceptors[F, O]
  20. val exceptionHandler: Option[ExceptionHandler[F]]
  21. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  22. def interceptors: List[Interceptor[F]]

    Creates the default interceptor stack

  23. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  24. def metricsInterceptor(m: Option[MetricsRequestInterceptor[F]]): CustomiseInterceptors[F, O]
  25. def metricsInterceptor(m: MetricsRequestInterceptor[F]): CustomiseInterceptors[F, O]
  26. val metricsInterceptor: Option[MetricsRequestInterceptor[F]]
  27. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  28. def notAcceptableInterceptor(u: Option[NotAcceptableInterceptor[F]]): CustomiseInterceptors[F, O]
  29. def notAcceptableInterceptor(u: NotAcceptableInterceptor[F]): CustomiseInterceptors[F, O]
  30. val notAcceptableInterceptor: Option[NotAcceptableInterceptor[F]]
  31. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  32. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  33. def options: O
  34. def prependInterceptor(i: Interceptor[F]): CustomiseInterceptors[F, O]
  35. val prependedInterceptors: List[Interceptor[F]]
  36. def productElementNames: Iterator[String]
    Definition Classes
    Product
  37. def rejectHandler(r: Option[RejectHandler[F]]): CustomiseInterceptors[F, O]
  38. def rejectHandler(r: RejectHandler[F]): CustomiseInterceptors[F, O]
  39. val rejectHandler: Option[RejectHandler[F]]
  40. def serverLog(log: Option[ServerLog[F]]): CustomiseInterceptors[F, O]
  41. def serverLog(log: ServerLog[F]): CustomiseInterceptors[F, O]
  42. val serverLog: Option[ServerLog[F]]
  43. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  44. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  45. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  46. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped