A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learn.microsoft.com/en-us/java/api/com.azure.core.http.policy.addheadersfromcontextpolicy below:

AddHeadersFromContextPolicy Class | Microsoft Learn

AddHeadersFromContextPolicy Class

Implements

public class AddHeadersFromContextPolicy
implements HttpPipelinePolicy

The pipeline policy that override or add HttpHeaders in HttpRequest by reading values from Context with key 'azure-http-headers-key'. The value for this key should be of type HttpHeaders for it to be added in HttpRequest.

Code Sample: Add multiple HttpHeader in Context and call client

// Create ConfigurationClient for example
 ConfigurationClient configurationClient = new ConfigurationClientBuilder()
 .connectionString("endpoint={endpoint_value};id={id_value};secret={secret_value}")
 .buildClient();
 // Add your headers
 HttpHeaders headers = new HttpHeaders();
 headers.put("my-header1", "my-header1-value");
 headers.put("my-header2", "my-header2-value");
 headers.put("my-header3", "my-header3-value");
 // Call API by passing headers in Context.
 configurationClient.addConfigurationSettingWithResponse(
 new ConfigurationSetting().setKey("key").setValue("value"),
 new Context(AddHeadersFromContextPolicy.AZURE_REQUEST_HTTP_HEADERS_KEY, headers));
 // Above three HttpHeader will be added in outgoing HttpRequest.
Field Summary Constructor Summary Method Summary Methods inherited from java.lang.Object Field Details AZURE_REQUEST_HTTP_HEADERS_KEY

public static final String AZURE_REQUEST_HTTP_HEADERS_KEY

Key used to override headers in HttpRequest. The Value for this key should be HttpHeaders.

Constructor Details AddHeadersFromContextPolicy Method Details process

public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next)

Processes provided request context and invokes the next policy.

Parameters:

context

next

processSync

public HttpResponse processSync(HttpPipelineCallContext context, HttpPipelineNextSyncPolicy next)

Processes provided request context and invokes the next policy synchronously.

Parameters:

context

next

Applies to

Collaborate with us on GitHub

The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide. In this article

Was this page helpful?


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4