ServerFilters

Types

Link copied to clipboard
object ApiKeyAuth

ApiKey token checking.

Link copied to clipboard
object BasicAuth

Simple Basic Auth credential checking.

Link copied to clipboard
object BearerAuth

Bearer Auth token checking.

Link copied to clipboard
object CatchAll

Last gasp filter which catches all Throwables and invokes onError. The default onError is backward compatible with previous implementations, returning INTERNAL_SERVER_ERROR and a formatted stack trace for Exceptions, and leaking other Throwables.

Link copied to clipboard

Sets the Content-Disposition response header on the Response for the selected path extensions. By default all extensions are selected, including paths with no extension. If no path is present, the filename will be set to unnamed.

Link copied to clipboard

Copy headers from the incoming request to the outbound response.

Link copied to clipboard
object Cors

Add Cors headers to the Response, according to the passed CorsPolicy

Link copied to clipboard
object GZip

Basic GZip and Gunzip support of Request/Response. Only Gunzips requests which contain "content-encoding" header containing 'gzip' Only Gzips responses when request contains "accept-encoding" header containing 'gzip'.

Link copied to clipboard
class GZipContentTypes(compressibleContentTypes: Set<ContentType>, compressionMode: GzipCompressionMode = Memory(), maxDecompressedSize: Long = MAX_DECOMPRESSED_SIZE.toLong()) : Filter

Basic GZip and Gunzip support of Request/Response where the content-type is in the allowed list. Only Gunzips requests which contain "content-encoding" header containing 'gzip' Only Gzips responses when request contains "accept-encoding" header containing 'gzip' and the content-type (sans-charset) is one of the compressible types.

Link copied to clipboard

Initialise a RequestContext for each request which passes through the Filter stack,

Link copied to clipboard

Intercepts responses and replaces the contents with contents of the statically loaded resource. By default, this Filter replaces the contents of unsuccessful requests with the contents of a file named after the status code.

Link copied to clipboard

Adds Zipkin request tracing headers to the incoming request and outbound response. (traceid, spanid, parentspanid)

Link copied to clipboard

Sets the Content Type response header on the Response.

Link copied to clipboard

Checks that client supplied values are valid, and either remove or reject

Properties

Link copied to clipboard

Converts Lens extraction failures into correct HTTP responses (Bad Requests/UnsupportedMediaType). This is required when using lenses to automatically unmarshall inbound requests. Note that LensFailures from unmarshalling upstream Response objects are NOT caught to avoid incorrect server behaviour.

Functions

Link copied to clipboard
fun CatchLensFailure(failResponseFn: (LensFailure) -> Response): Filter
fun CatchLensFailure(failResponseFn: (Request, LensFailure) -> Response = { _, lensFailure -> Response(BAD_REQUEST.description(lensFailure.failures.joinToString("; "))) }): Filter

Converts Lens extraction failures into correct HTTP responses (Bad Requests/UnsupportedMediaType). This is required when using lenses to automatically unmarshall inbound requests. Note that LensFailures from unmarshalling upstream Response objects are NOT caught to avoid incorrect server behaviour.

Link copied to clipboard

Convenience method to report the HTTP transaction to the Events system.