@Priority(value=3000) public final class EncodingFilter extends Object implements ContainerResponseFilter
encoders
) and decides what encoding should be chosen
based on the encodings listed in the Accept-Encoding request header and their associated quality values.
If none of the acceptable encodings is supported and identity encoding is explicitly forbidden by the client,
the filter generates Response.Status.NOT_ACCEPTABLE
response.
The filter also ensures Accept-Encoding is added to the Vary header, for proper interaction with web caches.
Constructor and Description |
---|
EncodingFilter() |
Modifier and Type | Method and Description |
---|---|
static void |
enableFor(ResourceConfig rc,
Class<? extends ContentEncoder>... encoders)
Enables this filter along with the provided
encoders
for the supplied ResourceConfig . |
void |
filter(ContainerRequestContext request,
ContainerResponseContext response) |
@SafeVarargs public static void enableFor(ResourceConfig rc, Class<? extends ContentEncoder>... encoders)
encoders
for the supplied ResourceConfig
.rc
- Resource config this filter should be enabled for.encoders
- content encoders.public void filter(ContainerRequestContext request, ContainerResponseContext response) throws IOException
filter
in interface ContainerResponseFilter
IOException
Copyright © 2007-2024, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.