Package feign
Interface RequestInterceptor
-
- All Known Implementing Classes:
BasicAuthRequestInterceptor
public interface RequestInterceptor
Zero or moreRequestInterceptors
may be configured for purposes such as adding headers to all requests. No guarantees are give with regards to the order that interceptors are applied. Once interceptors are applied,Target.apply(RequestTemplate)
is called to create the immutable http request sent viaClient.execute(Request, feign.Request.Options)
.
For example:
public void apply(RequestTemplate input) { input.header("X-Auth", currentToken); }
Configuration
RequestInterceptors
are configured viaFeign.Builder.requestInterceptors
.
Implementation notes
Do not add parameters, such as/path/{foo}/bar
in your implementation ofapply(RequestTemplate)
.
Interceptors are applied after the template's parameters areresolved
. This is to ensure that you can implement signatures are interceptors.
Relationship to Retrofit 1.x
This class is similar toRequestInterceptor.intercept()
, except that the implementation can read, remove, or otherwise mutate any part of the request template.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
apply(RequestTemplate template)
Called for every request.
-
-
-
Method Detail
-
apply
void apply(RequestTemplate template)
Called for every request. Add data using methods on the suppliedRequestTemplate
.
-
-