Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions sdk/appconfiguration/azure-data-appconfiguration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,22 @@ ConfigurationSetting setting = client.setReadOnly("some_key", "some_label", fals

When you interact with App Configuration using this Java client library, errors returned by the service correspond to the same HTTP status codes returned for [REST API][rest_api] requests. For example, if you try to retrieve a configuration setting that doesn't exist in your configuration store, a `404` error is returned, indicating `Not Found`.

App Configuration provides a way to define customized headers through `Context` object in the public API.

```java
// 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.
```
For more detail information, check out the [AddHeadersFromContextPolicy][add_headers_from_context_policy]

## Next steps

- Samples are explained in detail [here][samples_readme].
Expand Down Expand Up @@ -338,5 +354,6 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m
[source_code]: src
[spring_quickstart]: https://docs.microsoft.com/azure/azure-app-configuration/quickstart-java-spring-app
[performance_tuning]: https://github.com/Azure/azure-sdk-for-java/wiki/Performance-Tuning
[add_headers_from_context_policy]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/AddHeadersFromContextPolicy.java

![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fappconfiguration%2Fazure-data-appconfiguration%2FREADME.png)
4 changes: 2 additions & 2 deletions sdk/appconfiguration/azure-data-appconfiguration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
<version>1.1.0</version> <!-- {x-version-update;com.azure:azure-core;dependency} -->
<version>1.2.0-beta.1</version> <!-- {x-version-update;com.azure:azure-core;dependency} -->
Comment thread
alzimmermsft marked this conversation as resolved.
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand All @@ -46,7 +46,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-netty</artifactId>
<version>1.1.0</version> <!-- {x-version-update;com.azure:azure-core-http-netty;dependency} -->
<version>1.2.0-beta.1</version> <!-- {x-version-update;com.azure:azure-core-http-netty;dependency} -->
Comment thread
mssfang marked this conversation as resolved.
Outdated
</dependency>

<!-- Test dependencies -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.HttpPipelineBuilder;
import com.azure.core.http.policy.AddDatePolicy;
import com.azure.core.http.policy.AddHeadersFromContextPolicy;
import com.azure.core.http.policy.AddHeadersPolicy;
import com.azure.core.http.policy.BearerTokenAuthenticationPolicy;
import com.azure.core.http.policy.HttpLogDetailLevel;
Expand Down Expand Up @@ -178,6 +179,7 @@ public ConfigurationAsyncClient buildAsyncClient() {
policies.add(new UserAgentPolicy(httpLogOptions.getApplicationId(), clientName, clientVersion,
buildConfiguration));
policies.add(new RequestIdPolicy());
policies.add(new AddHeadersFromContextPolicy());
policies.add(new AddHeadersPolicy(headers));
policies.add(new AddDatePolicy());

Expand Down