-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
ClientInterceptor.java
38 lines (33 loc) · 1.52 KB
/
ClientInterceptor.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* Copyright 2012-2022 The Feign Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package feign;
import java.util.Iterator;
/**
* Zero or One {@code ClientInterceptor} may be configured for purposes such as tracing - mutate
* headers, execute the call, parse the response and close any previously created objects.
*/
public interface ClientInterceptor {
ClientInterceptor DEFAULT = (context, iterator) -> null;
/**
* Allows to make an around instrumentation. Remember to call the next interceptor by calling
* {@code ClientInterceptor interceptor = iterator.next(); return interceptor.around(context, iterator)}.
*
* @param context input context to send a request
* @param iterator iterator to the next {@link ClientInterceptor}
* @return response or an exception - remember to rethrow an exception if it occurrs
* @throws FeignException exception while trying to send a request
*/
Response around(ClientInvocationContext context, Iterator<ClientInterceptor> iterator)
throws FeignException;
}