HttpRequestInterceptorList.java revision 417f3b92ba4549b2f22340e3107d869d2b9c5bb8
1/*
2 * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/protocol/HttpRequestInterceptorList.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
34import java.util.List;
35
36import org.apache.http.HttpRequestInterceptor;
37
38/**
39 * Provides access to an ordered list of request interceptors.
40 * Lists are expected to be built upfront and used read-only afterwards
41 * for {@link HttpProcessor processing}.
42 *
43 * @author <a href="mailto:rolandw at apache.org">Roland Weber</a>
44 *
45 * @version $Revision: 554903 $
46 *
47 * @since 4.0
48 */
49public interface HttpRequestInterceptorList {
50
51    /**
52     * Appends a request interceptor to this list.
53     *
54     * @param itcp      the request interceptor to add
55     */
56    void addRequestInterceptor(HttpRequestInterceptor itcp)
57        ;
58
59
60    /**
61     * Inserts a request interceptor at the specified index.
62     *
63     * @param itcp      the request interceptor to add
64     * @param index     the index to insert the interceptor at
65     */
66    void addRequestInterceptor(HttpRequestInterceptor itcp, int index);
67
68
69    /**
70     * Obtains the current size of this list.
71     *
72     * @return  the number of request interceptors in this list
73     */
74    int getRequestInterceptorCount()
75        ;
76
77
78    /**
79     * Obtains a request interceptor from this list.
80     *
81     * @param index     the index of the interceptor to obtain,
82     *                  0 for first
83     *
84     * @return  the interceptor at the given index, or
85     *          <code>null</code> if the index is out of range
86     */
87    HttpRequestInterceptor getRequestInterceptor(int index)
88        ;
89
90
91    /**
92     * Removes all request interceptors from this list.
93     */
94    void clearRequestInterceptors()
95        ;
96
97
98    /**
99     * Removes all request interceptor of the specified class
100     *
101     * @param clazz  the class of the instances to be removed.
102     */
103    void removeRequestInterceptorByClass(Class clazz);
104
105
106    /**
107     * Sets the request interceptors in this list.
108     * This list will be cleared and re-initialized to contain
109     * all request interceptors from the argument list.
110     * If the argument list includes elements that are not request
111     * interceptors, the behavior is implementation dependent.
112     *
113     * @param itcps     the list of request interceptors
114     */
115    void setInterceptors(List itcps)
116        ;
117
118
119} // interface HttpRequestInterceptorList
120
121