1 /*
2 * ====================================================================
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 * ====================================================================
20 *
21 * This software consists of voluntary contributions made by many
22 * individuals on behalf of the Apache Software Foundation. For more
23 * information on the Apache Software Foundation, please see
24 * <http://www.apache.org/>.
25 *
26 */
27
28 package org.apache.http.protocol;
29
30 import java.util.List;
31
32 import org.apache.http.HttpRequestInterceptor;
33
34 /**
35 * Provides access to an ordered list of request interceptors.
36 * Lists are expected to be built upfront and used read-only afterwards
37 * for {@link HttpProcessor processing}.
38 *
39 * @since 4.0
40 *
41 * @deprecated (4.3)
42 */
43 @Deprecated
44 public interface HttpRequestInterceptorList {
45
46 /**
47 * Appends a request interceptor to this list.
48 *
49 * @param interceptor the request interceptor to add
50 */
51 void addRequestInterceptor(HttpRequestInterceptor interceptor);
52
53 /**
54 * Inserts a request interceptor at the specified index.
55 *
56 * @param interceptor the request interceptor to add
57 * @param index the index to insert the interceptor at
58 */
59 void addRequestInterceptor(HttpRequestInterceptor interceptor, int index);
60
61 /**
62 * Obtains the current size of this list.
63 *
64 * @return the number of request interceptors in this list
65 */
66 int getRequestInterceptorCount();
67
68 /**
69 * Obtains a request interceptor from this list.
70 *
71 * @param index the index of the interceptor to obtain,
72 * 0 for first
73 *
74 * @return the interceptor at the given index, or
75 * <code>null</code> if the index is out of range
76 */
77 HttpRequestInterceptor getRequestInterceptor(int index);
78
79 /**
80 * Removes all request interceptors from this list.
81 */
82 void clearRequestInterceptors();
83
84 /**
85 * Removes all request interceptor of the specified class
86 *
87 * @param clazz the class of the instances to be removed.
88 */
89 void removeRequestInterceptorByClass(Class<? extends HttpRequestInterceptor> clazz);
90
91 /**
92 * Sets the request interceptors in this list.
93 * This list will be cleared and re-initialized to contain
94 * all request interceptors from the argument list.
95 * If the argument list includes elements that are not request
96 * interceptors, the behavior is implementation dependent.
97 *
98 * @param list the list of request interceptors
99 */
100 void setInterceptors(List<?> list);
101
102 }
103