August 2019
Intermediate to advanced
256 pages
6h 43m
English
Let's say you want to specify credentials in the HTTP authorization header to a secure remote service, but you do not want to have a string authHeader parameter in the client interface method. The MP-RC @ClientHeaderParam annotation can be used to specify HTTP headers that should be sent without altering the client interface method signature.
The following example illustrates two uses of the @ClientHeaderParam annotation to provide a User-Agent HTTP header in a variation of the WorldClockApi interface:
WorldClockApiWithHeaders.javapublic interface WorldClockApiWithHeaders { static final String BASE_URL = "http://worldclockapi.com/api/json"; default String lookupUserAgent() { Config config = ConfigProvider.getConfig(); ...Read now
Unlock full access