From 11bb0b6e4d57f8c99e1a1cb3bfc9e0b82a4ffb47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20H=C3=A1la?= Date: Sun, 17 Jan 2021 17:44:21 +0100 Subject: [PATCH] Add Passing Client Headers section to rest-client.adoc --- docs/src/main/asciidoc/rest-client.adoc | 28 ++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/src/main/asciidoc/rest-client.adoc b/docs/src/main/asciidoc/rest-client.adoc index d83e09d7d1d64..e636c157af7de 100644 --- a/docs/src/main/asciidoc/rest-client.adoc +++ b/docs/src/main/asciidoc/rest-client.adoc @@ -220,7 +220,6 @@ country-api/mp-rest/url=https://restcountries.eu/rest # country-api/mp-rest/scope=javax.inject.Singleton # / ---- - === Disabling Hostname Verification To disable the SSL hostname verification for a specific REST client, add the following property to your configuration: @@ -557,6 +556,33 @@ public class RequestUUIDHeaderFactory implements ClientHeadersFactory { Any CDI bean matching the declared factory class will be picked up and can of course benefit from the usual CDI infrastructure. +=== Default header factory +You can also use `@RegisterClientHeaders` annotation without any custom factory specified. In that case the `DefaultClientHeadersFactoryImpl` factory will be used and all headers listed in `org.eclipse.microprofile.rest.client.propagateHeaders` configuration property will be amended. Individual header names are comma-separated. +[source, java] +---- + +@Path("/v2") +@RegisterRestClient +@RegisterClientHeaders +public interface CountriesService { + + @GET + @Path("/name/{name}") + @Produces("application/json") + Set getByName(@PathParam String name); + + @GET + @Path("/name/{name}") + @Produces("application/json") + CompletionStage> getByNameAsync(@PathParam String name); +} +---- + +[source,properties] +---- +org.eclipse.microprofile.rest.client.propagateHeaders=Authorization,Proxy-Authorization +---- + == Package and run the application Run the application with: `./mvnw compile quarkus:dev`.