HttpResponseInterceptorList.java revision 069490a5ca2fd1988d29daf45d892f47ad665115
1/*
2 * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/protocol/HttpResponseInterceptorList.java $
3 * $Revision: 554903 $
4 * $Date: 2007-07-10 03:54:17 -0700 (Tue, 10 Jul 2007) $
5 *
6 * ====================================================================
7 * Licensed to the Apache Software Foundation (ASF) under one
8 * or more contributor license agreements.  See the NOTICE file
9 * distributed with this work for additional information
10 * regarding copyright ownership.  The ASF licenses this file
11 * to you under the Apache License, Version 2.0 (the
12 * "License"); you may not use this file except in compliance
13 * with the License.  You may obtain a copy of the License at
14 *
15 *   http://www.apache.org/licenses/LICENSE-2.0
16 *
17 * Unless required by applicable law or agreed to in writing,
18 * software distributed under the License is distributed on an
19 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20 * KIND, either express or implied.  See the License for the
21 * specific language governing permissions and limitations
22 * under the License.
23 * ====================================================================
24 *
25 * This software consists of voluntary contributions made by many
26 * individuals on behalf of the Apache Software Foundation.  For more
27 * information on the Apache Software Foundation, please see
28 * <http://www.apache.org/>.
29 *
30 */
31
32package org.apache.http.protocol;
33
34
35import java.util.List;
36
37import org.apache.http.HttpResponseInterceptor;
38
39
40/**
41 * Provides access to an ordered list of response interceptors.
42 * Lists are expected to be built upfront and used read-only afterwards
43 * for {@link HttpProcessor processing}.
44 *
45 * @author <a href="mailto:rolandw at apache.org">Roland Weber</a>
46 *
47 * @version $Revision: 554903 $
48 *
49 * @since 4.0
50 */
51public interface HttpResponseInterceptorList {
52
53    /**
54     * Appends a response interceptor to this list.
55     *
56     * @param itcp      the response interceptor to add
57     */
58    void addResponseInterceptor(HttpResponseInterceptor itcp)
59        ;
60
61    /**
62     * Inserts a response interceptor at the specified index.
63     *
64     * @param itcp      the response interceptor to add
65     * @param index     the index to insert the interceptor at
66     */
67    void addResponseInterceptor(HttpResponseInterceptor itcp, int index);
68
69
70    /**
71     * Obtains the current size of this list.
72     *
73     * @return  the number of response interceptors in this list
74     */
75    int getResponseInterceptorCount()
76        ;
77
78
79    /**
80     * Obtains a response interceptor from this list.
81     *
82     * @param index     the index of the interceptor to obtain,
83     *                  0 for first
84     *
85     * @return  the interceptor at the given index, or
86     *          <code>null</code> if the index is out of range
87     */
88    HttpResponseInterceptor getResponseInterceptor(int index)
89        ;
90
91
92    /**
93     * Removes all response interceptors from this list.
94     */
95    void clearResponseInterceptors()
96        ;
97
98
99    /**
100     * Removes all response interceptor of the specified class
101     *
102     * @param clazz  the class of the instances to be removed.
103     */
104    void removeResponseInterceptorByClass(Class clazz);
105
106
107    /**
108     * Sets the response interceptors in this list.
109     * This list will be cleared and re-initialized to contain
110     * all response interceptors from the argument list.
111     * If the argument list includes elements that are not response
112     * interceptors, the behavior is implementation dependent.
113     *
114     * @param itcps     the list of response interceptors
115     */
116    void setInterceptors(List itcps)
117        ;
118
119
120} // interface HttpResponseInterceptorList
121
122