    001// Licensed under the Apache License, Version 2.0 (the "License");
    002// you may not use this file except in compliance with the License.
    003// You may obtain a copy of the License at
    004//
    005// http://www.apache.org/licenses/LICENSE-2.0
    006//
    007// Unless required by applicable law or agreed to in writing, software
    008// distributed under the License is distributed on an "AS IS" BASIS,
    009// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    010// See the License for the specific language governing permissions and
    011// limitations under the License.
    012
    013package org.apache.tapestry5.services;
    014
    015import org.apache.tapestry5.ContentType;
    016import org.apache.tapestry5.services.assets.CompressionAnalyzer;
    017
    018/**
    019 * Used to determine if the client supports GZip compression of the response.
    020 *
    021 * @see CompressionAnalyzer
    022 * @see org.apache.tapestry5.SymbolConstants#GZIP_COMPRESSION_ENABLED
    023 * @since 5.1.0.0
    024 */
    025public interface ResponseCompressionAnalyzer
    026{
    027    /**
    028     * Checks the Accept-Encoding request header for a "gzip" token. Ensures that the protocol is not "HTTP/1.0", which
    029     * does not correctly support GZip encoding (in older Internet Explorer browsers).
    030     *
    031     * @return true if gzip is supported by client
    032     */
    033    boolean isGZipSupported();
    034
    035    /**
    036     * Uses {@link CompressionAnalyzer} to determine if the content is compressable, but only if the request
    037     * indicates the client supports compression.
    038     *
    039     * @param contentType
    040     * @return true if the content can be compressed for the current request
    041     * @since 5.4
    042     */
    043    boolean isGZipEnabled(ContentType contentType);
    044}