@Retention(value=RUNTIME) @Target(value=PARAMETER) public @interface HeaderMap
Headers
annotation does not allow this because the
header fields that it defines are static (it is not possible to add or remove fields on a
per-request basis), and doing this using a custom Target
or RequestInterceptor
can be cumbersome (it requires more code for per-method customization, it is difficult to
implement in a thread-safe manner and it requires customization when the Feign client for the API
is built). ... @RequestLine("GET /servers/{serverId}") void get(@Param("serverId") String serverId, @HeaderMap MapThe annotated parameter must be an instance of); ...
Map
, and the keys must be Strings. The
header field value of a key will be the value of its toString method, except in the following
cases: Iterable
, it is converted to a List
of String objects
where each value in the list is either null if the original value was null or the value's
toString representation otherwise.
RequestTemplate.header(String, String...)
.Copyright © 2012–2020 OpenFeign. All rights reserved.