BrotliFilter

play.filters.brotli.BrotliFilter
@Singleton
class BrotliFilter(config: BrotliFilterConfig)(implicit mat: Materializer) extends EssentialFilter

A brotli filter.

This filter may compress with brotli the responses for any requests that aren't HEAD requests and specify an accept encoding of brotli.

It won't compresss under the following conditions:

  • The response code is 204 or 304 (these codes MUST NOT contain a body, and an empty compressed response is 20 bytes long)
  • The response already defines a Content-Encoding header
  • A custom shouldBrotli function is supplied and it returns false

Since compressing changes the content length of the response, this filter may do some buffering - it will buffer any streamed responses that define a content length less than the configured chunked threshold. Responses that are greater in length, or that don't define a content length, will not be buffered, but will be sent as chunked responses.

Attributes

Graph
Supertypes
trait EssentialFilter
class Object
trait Matchable
class Any

Members list

Value members

Constructors

def this(quality: Int, bufferSize: Int, chunkedThreshold: Int, shouldBrotli: (RequestHeader, Result) => Boolean)(implicit mat: Materializer)

Concrete methods

def apply(next: EssentialAction): EssentialAction

Inherited methods

def asJava: EssentialFilter

Attributes

Inherited from:
EssentialFilter