View Javadoc
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.HttpResponseInterceptor;
33  
34  /**
35   * Provides access to an ordered list of response 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 HttpResponseInterceptorList {
45  
46      /**
47       * Appends a response interceptor to this list.
48       *
49       * @param interceptor the response interceptor to add
50       */
51      void addResponseInterceptor(HttpResponseInterceptor interceptor);
52  
53      /**
54       * Inserts a response interceptor at the specified index.
55       *
56       * @param interceptor the response interceptor to add
57       * @param index     the index to insert the interceptor at
58       */
59      void addResponseInterceptor(HttpResponseInterceptor interceptor, int index);
60  
61      /**
62       * Obtains the current size of this list.
63       *
64       * @return  the number of response interceptors in this list
65       */
66      int getResponseInterceptorCount();
67  
68      /**
69       * Obtains a response 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} if the index is out of range
76       */
77      HttpResponseInterceptor getResponseInterceptor(int index);
78  
79      /**
80       * Removes all response interceptors from this list.
81       */
82      void clearResponseInterceptors();
83  
84      /**
85       * Removes all response interceptor of the specified class
86       *
87       * @param clazz  the class of the instances to be removed.
88       */
89      void removeResponseInterceptorByClass(Class<? extends HttpResponseInterceptor> clazz);
90  
91      /**
92       * Sets the response interceptors in this list.
93       * This list will be cleared and re-initialized to contain
94       * all response interceptors from the argument list.
95       * If the argument list includes elements that are not response
96       * interceptors, the behavior is implementation dependent.
97       *
98       * @param list the list of response interceptors
99       */
100     void setInterceptors(List<?> list);
101 
102 }
103