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 should usually be added using addInterceptor.
That way, the custom interceptor is called after the built-in ones (such as logging, metrics, exceptions), and before the decode failure
handler. For even more flexibility, interceptors can be added to the beginning or end of the interceptor stack, using
prependInterceptor and appendInterceptor.
The first interceptor in the interceptor stack is the one which is called first on request, and processes the resulting response as the last one.
Built-in interceptors can be customised or disabled using the dedicated methods.
Once done, use options to obtain the server interpreter options objects, which can be passed to the server interpreter.
- 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
Acceptheader.- additionalInterceptors
Additional interceptors, which will be called before (on request) / after (on response) the
decodeFailureHandlerone, 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.
- Alphabetic
- By Inheritance
- CustomiseInterceptors
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- 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
Acceptheader.- additionalInterceptors
Additional interceptors, which will be called before (on request) / after (on response) the
decodeFailureHandlerone, 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
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def addInterceptor(i: Interceptor[F]): CustomiseInterceptors[F, O]
- val additionalInterceptors: List[Interceptor[F]]
- def appendInterceptor(i: Interceptor[F]): CustomiseInterceptors[F, O]
- val appendedInterceptors: List[Interceptor[F]]
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def corsInterceptor(c: Option[CORSInterceptor[F]]): CustomiseInterceptors[F, O]
- def corsInterceptor(c: CORSInterceptor[F]): CustomiseInterceptors[F, O]
- val corsInterceptor: Option[CORSInterceptor[F]]
- val createOptions: (CustomiseInterceptors[F, O]) => O
- def decodeFailureHandler(d: DecodeFailureHandler): CustomiseInterceptors[F, O]
- val decodeFailureHandler: DecodeFailureHandler
- 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
errorMessageOutputwhen the request was rejected by all endpoints, instead of propagating the rejection to the server library
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def exceptionHandler(e: Option[ExceptionHandler[F]]): CustomiseInterceptors[F, O]
- def exceptionHandler(e: ExceptionHandler[F]): CustomiseInterceptors[F, O]
- val exceptionHandler: Option[ExceptionHandler[F]]
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def interceptors: List[Interceptor[F]]
Creates the default interceptor stack
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def metricsInterceptor(m: Option[MetricsRequestInterceptor[F]]): CustomiseInterceptors[F, O]
- def metricsInterceptor(m: MetricsRequestInterceptor[F]): CustomiseInterceptors[F, O]
- val metricsInterceptor: Option[MetricsRequestInterceptor[F]]
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def notAcceptableInterceptor(u: Option[NotAcceptableInterceptor[F]]): CustomiseInterceptors[F, O]
- def notAcceptableInterceptor(u: NotAcceptableInterceptor[F]): CustomiseInterceptors[F, O]
- val notAcceptableInterceptor: Option[NotAcceptableInterceptor[F]]
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def options: O
- def prependInterceptor(i: Interceptor[F]): CustomiseInterceptors[F, O]
- val prependedInterceptors: List[Interceptor[F]]
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def rejectHandler(r: Option[RejectHandler[F]]): CustomiseInterceptors[F, O]
- def rejectHandler(r: RejectHandler[F]): CustomiseInterceptors[F, O]
- val rejectHandler: Option[RejectHandler[F]]
- def serverLog(log: Option[ServerLog[F]]): CustomiseInterceptors[F, O]
- def serverLog(log: ServerLog[F]): CustomiseInterceptors[F, O]
- val serverLog: Option[ServerLog[F]]
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @Deprecated
- Deprecated