play.filters

gzip

package gzip

Visibility
  1. Public
  2. All

Type Members

  1. class GzipFilter extends EssentialFilter

    A gzip filter.

    A gzip filter.

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

    It will only gzip non chunked responses. Chunked responses are often comet responses, gzipping will interfere in that case. If you want to gzip a chunked response, you can apply the gzip enumeratee manually to the enumerator.

    For non chunked responses, it won't gzip under the following conditions:

    - The response code is 204 or 304 (these codes MUST NOT contain a body, and an empty gzipped response is 20 bytes long) - The response already defines a Content-Encoding header - The response content type is text/event-stream - A custom shouldGzip function is supplied and it returns false

    Since gzipping changes the content length of the response, this filter may do some buffering. If a content length is sent by the action, that content length is filtered out and ignored. If the connection flag on the result is Close, the filter will not attempt to buffer, and will simply rely on the closing the response to signify the end of the response. Otherwise, it will buffer up to the configured chunkedThreshold, which defaults to 100kb. If the response fits in that buffer, the filter will send the content length, otherwise it falls back to sending a chunked response, or if the protocol is HTTP/1.0, it closes the connection at the end of the response.

    Annotations
    @Singleton()
  2. trait GzipFilterComponents extends AnyRef

    The gzip filter components.

  3. case class GzipFilterConfig(gzip: Enumeratee[Array[Byte], Array[Byte]] = Gzip.gzip(8192), chunkedThreshold: Int = 102400, shouldGzip: (RequestHeader, ResponseHeader) ⇒ Boolean = (_, _) => true) extends Product with Serializable

    Configuration for the gzip filter

    Configuration for the gzip filter

    gzip

    The gzip enumeratee to use.

    chunkedThreshold

    The content length threshold, after which the filter will switch to chunking the result.

    shouldGzip

    Whether the given request/result should be gzipped. This can be used, for example, to implement black/white lists for gzipping by content type.

  4. class GzipFilterConfigProvider extends Provider[GzipFilterConfig]

    The gzip filter configuration provider.

    The gzip filter configuration provider.

    Annotations
    @Singleton()
  5. class GzipFilterModule extends Module

    The gzip filter module.

Value Members

  1. object Gzip

    Enumeratees for dealing with gzip streams

  2. object GzipFilter

  3. object GzipFilterConfig extends Serializable

Ungrouped