Skip to content

App Config - Head Requests#48899

Open
mrm9084 wants to merge 1 commit intoAzure:mainfrom
mrm9084:AppConfigHeadRequests
Open

App Config - Head Requests#48899
mrm9084 wants to merge 1 commit intoAzure:mainfrom
mrm9084:AppConfigHeadRequests

Conversation

@mrm9084
Copy link
Copy Markdown
Member

@mrm9084 mrm9084 commented Apr 22, 2026

Description

Adds head request support to the Java SDK.

See Python: Azure/azure-sdk-for-python#45858
See JS: Azure/azure-sdk-for-js#36959

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Copilot AI review requested due to automatic review settings April 22, 2026 19:18
@github-actions github-actions Bot added the App Configuration Azure.ApplicationModel.Configuration label Apr 22, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds HEAD-request support to the Azure App Configuration Java SDK to enable efficient change detection via page-level ETags, without downloading response bodies.

Changes:

  • Added checkConfigurationSettings APIs to both sync (ConfigurationClient) and async (ConfigurationAsyncClient) clients, backed by the service’s HEAD /kv endpoint.
  • Added unit tests covering HEAD paging behavior (empty items, page ETag presence) and ETag change detection.
  • Added a new sample demonstrating polling-style change detection with cached page ETags, and updated the changelog.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClient.java Adds sync checkConfigurationSettings API and JavaDoc samples.
sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationAsyncClient.java Adds async checkConfigurationSettings API and JavaDoc samples.
sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/Utility.java Adds helpers to translate HEAD responses into PagedResponse and handle 304 for HEAD, plus continuation parsing.
sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTest.java Adds sync tests for HEAD paging and ETag change detection.
sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationAsyncClientTest.java Adds async tests for HEAD paging and ETag change detection.
sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/CheckConfigurationSettingsForChanges.java New sample demonstrating HEAD-based change detection using page ETags + If-None-Match.
sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/package-info.java Updates package-level instantiation snippets.
sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java Updates builder JavaDoc instantiation/pipeline snippets.
sdk/appconfiguration/azure-data-appconfiguration/CHANGELOG.md Documents the new checkConfigurationSettings feature.

Comment on lines +216 to +229
// Parse the 'after' query parameter value from the Link header.
// Link header format: </kv?api-version=2023-10-01&$Select=&after=a2V5MTg4Cg%3D%3D>; rel="next"
public static String parseAfterParam(String linkHeader) {
String nextLink = parseNextLink(linkHeader);
if (nextLink == null) {
return null;
}
int afterIdx = nextLink.indexOf("after=");
if (afterIdx == -1) {
return null;
}
String afterValue = nextLink.substring(afterIdx + 6);
int ampIdx = afterValue.indexOf('&');
return ampIdx != -1 ? afterValue.substring(0, ampIdx) : afterValue;
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parseAfterParam returns the raw after value from the Link URL (e.g. ...after=a2V5...%3D%3D). The service proxy will URL-encode query params (since @QueryParam(encoded=false)), so passing an already-encoded value will double-encode (% -> %25) and break pagination. Decode the extracted value (e.g., URL-decode) before using it as the After query param continuation token.

Copilot uses AI. Check for mistakes.
import com.azure.core.exception.ResourceModifiedException;
import com.azure.core.exception.ResourceNotFoundException;
import com.azure.core.http.HttpResponse;
import com.azure.core.http.HttpHeaderName;
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HttpHeaderName is imported but never used (it only appears fully-qualified in Javadoc). Unused imports fail compilation; remove this import or use the type in code/Javadoc without the fully-qualified reference.

Suggested change
import com.azure.core.http.HttpHeaderName;

Copilot uses AI. Check for mistakes.
Comment on lines +90 to +91
* .credential&#40;new DefaultAzureCredentialBuilder&#40;&#41;.build&#40;&#41;&#41;
* .endpoint&#40;endpoint&#41;
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The <!-- src_embed ... --> instantiation snippet content no longer matches the source snippet in ConfigurationClientJavaDocCodeSnippets.java (which still uses .connectionString(connectionString)). The codesnippet Maven plugin will fail validation/injection during build; update the snippet source (BEGIN/END block) instead, or revert this embedded code to match it.

Suggested change
* .credential&#40;new DefaultAzureCredentialBuilder&#40;&#41;.build&#40;&#41;&#41;
* .endpoint&#40;endpoint&#41;
* .connectionString&#40;connectionString&#41;

Copilot uses AI. Check for mistakes.
* <p>Check all settings that use the key "prodDBConnection".</p>
*
* <!-- src_embed com.azure.data.applicationconfig.configurationclient.checkConfigurationSettings#settingSelector-context -->
* <!-- src_embed com.azure.data.applicationconfig.configurationclient.checkConfigurationSettings#settingSelector-context -->
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate <!-- src_embed ... --> marker line will confuse the codesnippet injection/validation step. Remove the extra src_embed line so there is exactly one start marker paired with the <!-- end ... -->.

Suggested change
* <!-- src_embed com.azure.data.applicationconfig.configurationclient.checkConfigurationSettings#settingSelector-context -->

Copilot uses AI. Check for mistakes.
Comment on lines 72 to 90
@@ -82,7 +83,8 @@
* <!-- src_embed com.azure.data.applicationconfig.configurationclient.instantiation -->
* <pre>
* ConfigurationClient configurationClient = new ConfigurationClientBuilder&#40;&#41;
* .connectionString&#40;connectionString&#41;
* .credential&#40;new DefaultAzureCredentialBuilder&#40;&#41;.build&#40;&#41;&#41;
* .endpoint&#40;endpoint&#41;
* .buildClient&#40;&#41;;
* </pre>
* <!-- end com.azure.data.applicationconfig.configurationclient.instantiation -->
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instantiation src_embed blocks were edited directly, but the corresponding snippet sources in ConfigurationClientJavaDocCodeSnippets.java still use connection strings (and the codesnippet Maven plugin expects them to stay in sync). Update the // BEGIN: / // END: snippet source and let injection update this JavaDoc, otherwise snippet validation will fail.

Copilot uses AI. Check for mistakes.
Comment on lines +1131 to +1135
* <!-- src_embed com.azure.data.applicationconfig.configurationclient.checkConfigurationSettings#settingSelector-context -->
* <!-- src_embed com.azure.data.applicationconfig.configurationclient.checkConfigurationSettings#settingSelector-context -->
* <pre>
* SettingSelector selector = new SettingSelector&#40;&#41;.setKeyFilter&#40;&quot;my-app&#47;*&quot;&#41;;
* Context ctx = new Context&#40;key1, value1&#41;;
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This src_embed ID for the context overload (...checkConfigurationSettings#settingSelector-context) doesn’t appear to exist as a // BEGIN: / // END: snippet in the module sources. Add the missing snippet to the *JavaDocCodeSnippets.java sources so codesnippet validation passes.

Copilot uses AI. Check for mistakes.
Comment on lines +87 to +88
* .credential&#40;new DefaultAzureCredentialBuilder&#40;&#41;.build&#40;&#41;&#41;
* .endpoint&#40;endpoint&#41;
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instantiation src_embed block content here was changed to use credential() + endpoint(), but the snippet source (ConfigurationClientJavaDocCodeSnippets.java, BEGIN: com.azure.data.applicationconfig.async.configurationclient.instantiation) still uses .connectionString(connectionString). Update the snippet source and let the codesnippet plugin inject, otherwise builds will fail snippet validation.

Suggested change
* .credential&#40;new DefaultAzureCredentialBuilder&#40;&#41;.build&#40;&#41;&#41;
* .endpoint&#40;endpoint&#41;
* .connectionString&#40;connectionString&#41;

Copilot uses AI. Check for mistakes.
Comment on lines +1065 to +1075
* <!-- src_embed com.azure.data.appconfiguration.configurationasyncclient.checkConfigurationSettings -->
* <pre>
* SettingSelector selector = new SettingSelector&#40;&#41;.setKeyFilter&#40;&quot;my-app&#47;*&quot;&#41;;
* client.checkConfigurationSettings&#40;selector&#41;
* .byPage&#40;&#41;
* .subscribe&#40;page -&gt; &#123;
* System.out.println&#40;&quot;Status code: &quot; + page.getStatusCode&#40;&#41;&#41;;
* System.out.println&#40;&quot;Page ETag: &quot; + page.getHeaders&#40;&#41;.getValue&#40;com.azure.core.http.HttpHeaderName.ETAG&#41;&#41;;
* &#125;&#41;;
* </pre>
* <!-- end com.azure.data.appconfiguration.configurationasyncclient.checkConfigurationSettings -->
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new JavaDoc snippet reference com.azure.data.appconfiguration.configurationasyncclient.checkConfigurationSettings has no matching // BEGIN: / // END: snippet in the module sources. Add the snippet to the *JavaDocCodeSnippets.java file (or remove the src_embed markers) to avoid codesnippet plugin failures.

Copilot uses AI. Check for mistakes.
Comment on lines 34 to 55
@@ -48,7 +49,8 @@
* <!-- src_embed com.azure.data.applicationconfig.configurationclient.instantiation -->
* <pre>
* ConfigurationClient configurationClient = new ConfigurationClientBuilder&#40;&#41;
* .connectionString&#40;connectionString&#41;
* .credential&#40;new DefaultAzureCredentialBuilder&#40;&#41;.build&#40;&#41;&#41;
* .endpoint&#40;endpoint&#41;
* .buildClient&#40;&#41;;
* </pre>
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instantiation src_embed blocks here don’t match the snippet sources in ConfigurationClientJavaDocCodeSnippets.java (they still use .connectionString(connectionString)). This will fail the codesnippet Maven plugin validation/injection during build; update the snippet sources (BEGIN/END) instead of editing embedded code directly.

Copilot uses AI. Check for mistakes.
Comment on lines 49 to 55
* <!-- src_embed com.azure.data.applicationconfig.configurationclient.instantiation -->
* <pre>
* ConfigurationClient configurationClient = new ConfigurationClientBuilder&#40;&#41;
* .connectionString&#40;connectionString&#41;
* .credential&#40;new DefaultAzureCredentialBuilder&#40;&#41;.build&#40;&#41;&#41;
* .endpoint&#40;endpoint&#41;
* .buildClient&#40;&#41;;
* </pre>
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This instantiation snippet is referenced as a connection-string example in the surrounding package docs, but the code shown uses Entra ID (credential() + endpoint()). Please align the example and narrative so users aren’t misled about required inputs/authentication.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

App Configuration Azure.ApplicationModel.Configuration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants