feat: Migrate odata v2 and odata v4 to Apache HttpClient 5 - #1275
Open
ricardosrib wants to merge 8 commits into
Open
feat: Migrate odata v2 and odata v4 to Apache HttpClient 5#1275ricardosrib wants to merge 8 commits into
ricardosrib wants to merge 8 commits into
Conversation
…o hc5 APIs, remove CSRF token control methods now handled by the hc5 interceptor
…moved CSRF token control methods
| return jsonObject; | ||
| } | ||
|
|
||
| log.debug("GSON type adapter could not be found for entity property value of type {}.", typeToken); |
| log | ||
| .warn( | ||
| "Could not convert value of type {} to a {} representation.", | ||
| typeToken, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
This PR migrates the two higher-level OData modules v2 and v4 to Apache HttpClient 5, adding
odata-core-apache-httpclient5(OData v2) andodata-v4-core-apache-httpclient5(OData v4) as HC5 siblings to the existing HC4 modules. It follows the earlier migration of the lower-levelodata-client-apache-httpclient5module and completes the HC5 migration path for OData consumers.The migration preserves the existing public API — no breaking changes, at compile time or runtime — with one documented exception noted below.
Feature scope:
odata-core-apache-httpclient5module (OData v2, HC5)odata-v4-core-apache-httpclient5module (OData v4, HC5)org.apache.http.*APIs toorg.apache.hc.client5.*/org.apache.hc.core5.*HttpClientAccessortoApacheHttpClient5Accessor,execute(...)toexecuteOpen(...)ConnectionPoolTimeoutExceptiontoConnectionRequestTimeoutExceptionwithoutCsrfToken()for backward compatibility and depracatewithCsrfToken()as the CSRF token retrieval is now handled centrally by theCsrfTokenInterceptorwithoutCsrfToken()disables retrieval per request via an internal skip-marker header the interceptor honors and stripswithCsrfToken()retained as a documented@Deprecatedno-opdatamodel/pom.xmlAccepted behavioral difference between HC4 and HC5:
In HC4, calling
withCsrfToken()on a read request builder forced a HEAD probe and attached a token to the GET. In HC5, CSRF handling is centralized inCsrfTokenInterceptor, which fetches tokens only for mutating methods (POST/PUT/PATCH/DELETE). SowithCsrfToken()is now a@Deprecatedno-op.Not a breaking change: servers never validate CSRF tokens on safe methods like GET/HEAD, so a read returns the identical response either way.
Why only
withoutCsrfToken()was kept functionalwithoutCsrfToken()controls a mutating request (POST/PUT/PATCH/DELETE), where the CSRF HEAD probe is real and observable. Legacy code relies on it to suppress that fetch when the target doesn't use CSRF, so dropping it would cause unwanted HEAD probes and possible failures against servers that don't expect the fetch. So I kept it as an opt-out: it sets an internal skip header thatCsrfTokenInterceptordetects and strips, so no token is fetched.CsrfTokenOptOutTesttests it for create/update/delete/batch/action.Definition of Done
Error handling created / updated & covered by the tests aboveDocumentation updatedRelease notes updated