001/*
002 * ====================================================================
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 *   http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing,
014 * software distributed under the License is distributed on an
015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016 * KIND, either express or implied.  See the License for the
017 * specific language governing permissions and limitations
018 * under the License.
019 * ====================================================================
020 *
021 * This software consists of voluntary contributions made by many
022 * individuals on behalf of the Apache Software Foundation.  For more
023 * information on the Apache Software Foundation, please see
024 * <http://www.apache.org/>.
025 *
026 */
027
028package org.apache.http.protocol;
029
030import java.util.List;
031
032import org.apache.http.HttpResponseInterceptor;
033
034/**
035 * Provides access to an ordered list of response interceptors.
036 * Lists are expected to be built upfront and used read-only afterwards
037 * for {@link HttpProcessor processing}.
038 *
039 * @since 4.0
040 *
041 * @deprecated (4.3)
042 */
043@Deprecated
044public interface HttpResponseInterceptorList {
045
046    /**
047     * Appends a response interceptor to this list.
048     *
049     * @param interceptor the response interceptor to add
050     */
051    void addResponseInterceptor(HttpResponseInterceptor interceptor);
052
053    /**
054     * Inserts a response interceptor at the specified index.
055     *
056     * @param interceptor the response interceptor to add
057     * @param index     the index to insert the interceptor at
058     */
059    void addResponseInterceptor(HttpResponseInterceptor interceptor, int index);
060
061    /**
062     * Obtains the current size of this list.
063     *
064     * @return  the number of response interceptors in this list
065     */
066    int getResponseInterceptorCount();
067
068    /**
069     * Obtains a response interceptor from this list.
070     *
071     * @param index     the index of the interceptor to obtain,
072     *                  0 for first
073     *
074     * @return  the interceptor at the given index, or
075     *          {@code null} if the index is out of range
076     */
077    HttpResponseInterceptor getResponseInterceptor(int index);
078
079    /**
080     * Removes all response interceptors from this list.
081     */
082    void clearResponseInterceptors();
083
084    /**
085     * Removes all response interceptor of the specified class
086     *
087     * @param clazz  the class of the instances to be removed.
088     */
089    void removeResponseInterceptorByClass(Class<? extends HttpResponseInterceptor> clazz);
090
091    /**
092     * Sets the response interceptors in this list.
093     * This list will be cleared and re-initialized to contain
094     * all response interceptors from the argument list.
095     * If the argument list includes elements that are not response
096     * interceptors, the behavior is implementation dependent.
097     *
098     * @param list the list of response interceptors
099     */
100    void setInterceptors(List<?> list);
101
102}
103