Skip to content

Merge Apache 5.x Preview to Master #6220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 45 commits into from
Jul 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
f3fc974
Add initial empty module for Apache5x for seting up package (#6075)
joviegas Apr 30, 2025
5092cc4
Baseline or Copy all the ApacheSDKHttpClient classes to newly added A…
joviegas May 6, 2025
6e9939f
Phase 2 , getting Apache 5 compilation and Junit ready along with cle…
joviegas May 22, 2025
4dda3f7
Merge branch 'master' into feature/master/apache5x
joviegas May 25, 2025
3053d09
Update the snap shot
joviegas May 25, 2025
985ca35
Fix HTTP authentication retry failures by improving RepeatableInputSt…
joviegas May 28, 2025
b97c9da
Merge branch 'master' into feature/master/apache5x
joviegas May 29, 2025
64f7d33
Updated snap shot after merge from master
joviegas May 29, 2025
24438e8
Revert "Updated snap shot after merge from master"
joviegas May 29, 2025
62150d6
Updated snap shot after merge from master
joviegas May 29, 2025
fbfb70f
Fix architecture test failures for apache5.x (#6140)
joviegas May 29, 2025
3c4433c
Merge branch 'master' into feature/master/apache5x
joviegas May 30, 2025
6d8b5f4
Updated snap shot after merge from master
joviegas May 30, 2025
13c5796
Use reference of PoolingHttpClientConnectionManager instead of HttpCl…
joviegas Jun 2, 2025
0bdf878
Merge branch 'master' into feature/master/apache5x
joviegas Jun 2, 2025
265976d
Fix Apache5 HTTP client retry failures with non-resettable streams (#…
joviegas Jun 5, 2025
4671831
Merge branch 'master' into feature/master/apache5x
joviegas Jun 5, 2025
2f72282
Merge branch 'master' into feature/master/apache5x
joviegas Jun 17, 2025
79f6f0f
Merge PR#6165 https://github.com/aws/aws-sdk-java-v2/pull/6165
joviegas Jun 17, 2025
fcbc3c0
Disable Client based retries and define httpcore5 httpclient5 in .bra…
joviegas Jun 19, 2025
716a6db
Merge branch 'master' into feature/master/apache5x
joviegas Jun 21, 2025
09e8ee4
Update snapshots
joviegas Jun 21, 2025
ad30c25
Merge branch 'feature/master/apache5x' of github.com:aws/aws-sdk-java…
joviegas Jun 21, 2025
3cedfb1
Do not buffer the Response stream using BufferedHttpEntity (#6200)
joviegas Jun 24, 2025
959605c
Merge branch 'master' into feature/master/apache5x
joviegas Jun 24, 2025
a959581
Merge from master
joviegas Jun 24, 2025
e188995
Apache5x SDkBenhmark Tests (#6206)
joviegas Jun 26, 2025
3cc94bb
Clean up unused APIs and add test to make sure it can be handled with…
joviegas Jun 26, 2025
45f630d
Merge branch 'master' into feature/master/apache5x
joviegas Jun 26, 2025
67d6690
Upgrade Apache5 org.apache.httpcomponents.client5 to latest available…
joviegas Jun 26, 2025
c3cb46f
Preview API annotation added for Public APIs and TODOs addressed (#6215)
joviegas Jun 30, 2025
bb372da
Merge branch 'master' into feature/master/apache5x
joviegas Jun 30, 2025
d336053
Updated the snapshot
joviegas Jun 30, 2025
397f330
Updated thr Brazil package nma e to have preview as suffix
joviegas Jun 30, 2025
a21356a
Updated Version as -PREVIEW to release apache5 as preview release (#6…
joviegas Jul 1, 2025
4aa1fdb
Handled Surface API review comments (#6224)
joviegas Jul 3, 2025
198a814
Merge branch 'master' into feature/master/apache5x
joviegas Jul 7, 2025
661b152
update pom.xml for apache5.x
joviegas Jul 7, 2025
251490c
Handled commed for merge to master PR 6220 (#6240)
joviegas Jul 8, 2025
7a7e4cd
Merge branch 'master' into feature/master/apache5x
joviegas Jul 10, 2025
6383c44
Added change logs
joviegas Jul 10, 2025
ee93292
Merge branch 'master' into feature/master/apache5x
joviegas Jul 14, 2025
061b5fb
Review comment
joviegas Jul 14, 2025
f26f7bb
Handled Review comments
joviegas Jul 14, 2025
dfcfdcb
Merge branch 'master' into feature/master/apache5x
joviegas Jul 14, 2025
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
3 changes: 3 additions & 0 deletions .brazil.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"modules": {
"annotations": { "packageName": "AwsJavaSdk-Core-Annotations" },
"apache-client": { "packageName": "AwsJavaSdk-HttpClient-ApacheClient" },
"apache5-client": { "packageName": "AwsJavaSdk-HttpClient-Apache5Client" },
"arns": { "packageName": "AwsJavaSdk-Core-Arns" },
"auth": { "packageName": "AwsJavaSdk-Core-Auth" },
"auth-crt": { "packageName": "AwsJavaSdk-Core-AuthCrt" },
Expand Down Expand Up @@ -140,7 +141,9 @@
"io.netty:netty-transport-classes-epoll": { "packageName": "Netty4", "packageVersion": "4.1" },
"io.netty:netty-transport-native-unix-common": { "packageName": "Netty4", "packageVersion": "4.1" },
"org.apache.httpcomponents:httpclient": { "packageName": "Apache-HttpComponents-HttpClient", "packageVersion": "4.5.x" },
"org.apache.httpcomponents.client5:httpclient5": { "packageName": "Apache-HttpComponents-HttpClient5", "packageVersion": "5.0.x" },
"org.apache.httpcomponents:httpcore": { "packageName": "Apache-HttpComponents-HttpCore", "packageVersion": "4.4.x" },
"org.apache.httpcomponents.core5:httpcore5": { "packageName": "Apache-HttpComponents-HttpCore5", "packageVersion": "5.0.x" },
"org.eclipse.jdt:org.eclipse.jdt.core": { "packageName": "AwsJavaSdk-Codegen-EclipseJdtDependencies", "packageVersion": "2.0" },
"org.eclipse.text:org.eclipse.text": { "packageName": "AwsJavaSdk-Codegen-EclipseJdtDependencies", "packageVersion": "2.0" },
"org.reactivestreams:reactive-streams": { "packageName": "Maven-org-reactivestreams_reactive-streams", "packageVersion": "1.x" },
Expand Down
6 changes: 6 additions & 0 deletions .changes/next-release/feature-AWSSDKforJavav2-65d4de2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "feature",
"category": "Apache HTTP Client 5",
"contributor": "",
"description": "Preview Release of AWS SDK Apache5 HttpClient with Apache HttpClient 5.5.x"
}
10 changes: 10 additions & 0 deletions bom-internal/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@
<artifactId>httpcore</artifactId>
<version>${httpcomponents.httpcore.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>${httpcomponents.client5.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.core5</groupId>
<artifactId>httpcore5</artifactId>
<version>${httpcomponents.core5.version}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@
<artifactId>apache-client</artifactId>
<version>${awsjavasdk.version}</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>apache5-client</artifactId>
<version>${awsjavasdk.version}-PREVIEW</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>netty-nio-client</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@
<Class name="software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap"/>
<Class name="software.amazon.awssdk.http.nio.netty.internal.http2.FlushOnReadHandler"/>
<Class name="software.amazon.awssdk.http.apache.internal.conn.IdleConnectionReaper"/>
<Class name="software.amazon.awssdk.http.apache5.internal.conn.IdleConnectionReaper"/>
<Class name="software.amazon.awssdk.eventnotifications.s3.internal.DefaultS3EventNotificationWriter"/>
<Class name="software.amazon.awssdk.policybuilder.iam.internal.DefaultIamPolicyWriter"/>
</Or>
Expand Down Expand Up @@ -337,6 +338,7 @@
<Class name="~software\.amazon\.awssdk\.utils\.CompletableFutureUtils" />
<Class name="~software\.amazon\.awssdk\.metrics\.publishers\.cloudwatch\.CloudWatchMetricPublisher" />
<Class name="~software\.amazon\.awssdk\.http\.apache\.internal\.conn\.IdleConnectionReaper\$ReaperTask" />
<Class name="~software\.amazon\.awssdk\.http\.apache5\.internal\.conn\.IdleConnectionReaper\$ReaperTask" />
<Class name="~software\.amazon\.awssdk\.core\.internal\.retry\.RateLimitingTokenBucket" />
<Class name="~software\.amazon\.awssdk\.core\.internal\.waiters\.WaiterExecutor" />
<Class name="~software\.amazon\.awssdk\.regions\.internal\.util\.EC2MetadataUtils" />
Expand Down
36 changes: 36 additions & 0 deletions http-clients/apache-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,42 @@
<artifactId>wiremock-jre8</artifactId>
<scope>test</scope>
</dependency>

<!-- Added for WIRE logging details while testing-->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<scope>test</scope>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>


</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public static void setUp() throws IOException {

wireMockServer = new WireMockServer(wireMockConfig()
.dynamicHttpsPort()
.dynamicPort()
.needClientAuth(true)
.keystorePath(serverKeyStore.toAbsolutePath().toString())
.keystorePassword(STORE_PASSWORD)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package software.amazon.awssdk.http.apache;

import java.net.InetAddress;
import java.time.Duration;
import org.junit.jupiter.api.DisplayName;
import software.amazon.awssdk.http.SdkHttpClient;
import software.amazon.awssdk.http.SdkHttpClientLocalAddressFunctionalTestSuite;

@DisplayName("Apache HTTP Client - Local Address Functional Tests")
class ApacheHttpClientLocalAddressFunctionalTest extends SdkHttpClientLocalAddressFunctionalTestSuite {

@Override
protected SdkHttpClient createHttpClient(InetAddress localAddress, Duration connectionTimeout) {
return ApacheHttpClient.builder()
.localAddress(localAddress)
.connectionTimeout(connectionTimeout)
.build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

package software.amazon.awssdk.http.apache;

import software.amazon.awssdk.http.HttpClientUriNormalizationTestSuite;
import software.amazon.awssdk.http.SdkHttpClient;

public class ApacheHttpClientUriNormalizationTest extends HttpClientUriNormalizationTestSuite {


@Override
protected SdkHttpClient createSdkHttpClient() {
return ApacheHttpClient.create();
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

package software.amazon.awssdk.http.apache;


import org.junit.jupiter.api.DisplayName;
import software.amazon.awssdk.http.SdkHttpClient;
import software.amazon.awssdk.http.SdkHttpClientUriSanitizationTestSuite;

@DisplayName("Apache HTTP Client - URI Sanitization Tests")
class ApacheHttpClientUriSanitizationTest extends SdkHttpClientUriSanitizationTestSuite {

@Override
protected SdkHttpClient createHttpClient() {
return ApacheHttpClient.create();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import static com.github.tomakehurst.wiremock.client.WireMock.any;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static software.amazon.awssdk.http.SdkHttpConfigurationOption.TRUST_ALL_CERTIFICATES;
Expand Down Expand Up @@ -46,13 +48,15 @@
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import software.amazon.awssdk.http.HttpExecuteRequest;
import software.amazon.awssdk.http.HttpExecuteResponse;
import software.amazon.awssdk.http.SdkHttpClient;
import software.amazon.awssdk.http.SdkHttpClientTestSuite;
import software.amazon.awssdk.http.SdkHttpFullRequest;
import software.amazon.awssdk.http.SdkHttpMethod;
import software.amazon.awssdk.http.apache.internal.ApacheHttpRequestConfig;
import software.amazon.awssdk.http.apache.internal.impl.ConnectionManagerAwareHttpClient;
import software.amazon.awssdk.utils.AttributeMap;
import software.amazon.awssdk.utils.IoUtils;

@RunWith(MockitoJUnitRunner.class)
public class ApacheHttpClientWireMockTest extends SdkHttpClientTestSuite {
Expand Down Expand Up @@ -179,6 +183,45 @@ public void explicitNullDnsResolver_WithLocalhost_successful() throws Exception
overrideDnsResolver("localhost", true);
}

@Test
public void handlesVariousContentLengths() throws Exception {
SdkHttpClient client = createSdkHttpClient();
int[] contentLengths = {0, 1, 100, 1024, 65536};

for (int length : contentLengths) {
String path = "/content-length-" + length;
byte[] body = new byte[length];
for (int i = 0; i < length; i++) {
body[i] = (byte) ('A' + (i % 26));
}

mockServer.stubFor(any(urlPathEqualTo(path))
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Length", String.valueOf(length))
.withBody(body)));

SdkHttpFullRequest req = mockSdkRequest("http://localhost:" + mockServer.port() + path, SdkHttpMethod.GET);
HttpExecuteResponse rsp = client.prepareRequest(HttpExecuteRequest.builder()
.request(req)
.build())
.call();

assertThat(rsp.httpResponse().statusCode()).isEqualTo(200);

if (length == 0) {
// Empty body should still have a response body present, but EOF immediately
if (rsp.responseBody().isPresent()) {
assertThat(rsp.responseBody().get().read()).isEqualTo(-1);
}
} else {
assertThat(rsp.responseBody()).isPresent();
byte[] readBody = IoUtils.toByteArray(rsp.responseBody().get());
assertThat(readBody).isEqualTo(body);
}
}
}

private void overrideDnsResolver(String hostName) throws IOException {
overrideDnsResolver(hostName, false);
}
Expand Down Expand Up @@ -223,4 +266,23 @@ public InetAddress[] resolve(final String host) throws UnknownHostException {

mockProxyServer.verify(1, RequestPatternBuilder.allRequests());
}

@Test
public void closeReleasesResources() throws Exception {
SdkHttpClient client = createSdkHttpClient();
// Make a successful request first
stubForMockRequest(200);
SdkHttpFullRequest request = mockSdkRequest("http://localhost:" + mockServer.port(), SdkHttpMethod.POST);
HttpExecuteResponse response = client.prepareRequest(
HttpExecuteRequest.builder().request(request).build()).call();
response.responseBody().ifPresent(IoUtils::drainInputStream);
// Close the client
client.close();
// Verify subsequent requests fail
assertThatThrownBy(() -> {
client.prepareRequest(HttpExecuteRequest.builder().request(request).build()).call();
}).isInstanceOfAny(
IllegalStateException.class
).hasMessageContaining("Connection pool shut down");
}
}
Loading
Loading