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.http.services;
014
015import org.apache.tapestry5.ioc.annotations.UsesMappedConfiguration;
016
017/**
018 * Identifies which content types are compressable. In general, content types are assumed to be compressable. The
019 * configuration of the service identifies exceptions, which are usually image file formats.
020 *
021 * The configuration maps content types to boolean values (true for compressable).
022 *
023 * Since 5.4, the contributed values may also be a wild-card such as "image/*" (that is, the subtype
024 * may be a '*' to match any content type with the same top-level type).
025 *
026 * @since 5.3
027 */
028@UsesMappedConfiguration(boolean.class)
029public interface CompressionAnalyzer
030{
031    /**
032     * For a given MIME type, is the content compressable via GZip?
033     *
034     * @param contentType
035     *         MIME content type, possibly included attributes such as encoding type
036     * @return true if the content is not "naturally" compressed
037     */
038    boolean isCompressable(String contentType);
039}