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