Skip to content
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

Migrated to Spring Boot 3 #862

Merged
merged 5 commits into from
Sep 19, 2023

Conversation

mstrankowski
Copy link
Contributor

compiles, I was forced to update to httpclient5 from apache. Need to verify no impact on ssl mechanism after changes

@@ -73,7 +74,7 @@ public ResponseEntity<Resource> retrieveFile(String fileRef)
}
catch (HttpClientErrorException e)
{
throw new TransformException(e.getStatusCode(), e.getMessage(), e);
throw new TransformException(HttpStatus.resolve(e.getStatusCode().value()), e.getMessage(), e);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just providing int would lead to using a deprecated constructor.

final SSLConnectionSocketFactoryBuilder sslConnectionSocketFactoryBuilder =
SSLConnectionSocketFactoryBuilder.create()
.setSslContext(sslContextBuilder.build())
.setTlsVersions(TLS.V_1_2, TLS.V_1_3);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have such restriction implemented in Repo, so adding it here would make it consistent in my opinion.

.register("https", sslConnectionSocketFactory)
.build();

final BasicHttpClientConnectionManager sslConnectionManager = new BasicHttpClientConnectionManager(sslSocketFactoryRegistry);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's either this - basic, or poolable. I don't think we use poolable "perks" in transform-core at all, so I chose a basic option.

<artifactId>httpmime</artifactId>
<scope>test</scope>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Forced to update by spring 6 backing spring boot 3

SSLContext sslContext = sslContextBuilder.build();
SSLConnectionSocketFactory sslContextFactory = hostNameVerificationDisabled ? new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE)
: new SSLConnectionSocketFactory(sslContext);
final SSLConnectionSocketFactoryBuilder sslConnectionSocketFactoryBuilder =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exact same change as above in similar context. We just have a deprecated copy of code and a new one.

@@ -34,15 +34,15 @@ <h2 th:text="${title}"></h2>
<option value="text/plain">txt</option>
</select></td></tr>

<th:block th:each="i: ${#numbers.sequence(0, T(java.lang.Math).min(18, transformOptions.size) - 1)}">
<th:block th:each="i: ${#numbers.sequence(0, T(java.lang.Math).min(18, transformOptions.size()) - 1)}">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

SpEL had issues without brackets, when it tries to reach through parameter name it seems to go through reflection that is limited by context settings, with brackets it just calls the method without issues.


return HttpClients.custom().setSSLSocketFactory(sslContextFactory).build();
return HttpClients.custom().setConnectionManager(buildSslConnectionManager(sslContext)).build();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

similar as above, just for tests

@@ -71,17 +72,17 @@ public static String uploadFile(final String fileToUploadName, final String sfsB
sfsBaseUrl+"/alfresco/api/-default-/private/sfs/versions/1/file");
post.setEntity(MultipartEntityBuilder
.create()
.setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
.setMode(HttpMultipartMode.LEGACY)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Based on official documentation description for both of these options, they should be the same.

if (status >= 200 && status < 300)
{
return JacksonSerializer.readStringValue(EntityUtils.toString(response.getEntity()),
return JacksonSerializer.readStringValue(EntityUtils.toString(((HttpEntityContainer) response).getEntity()),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

response object stopped providing access to entity, needs to be cast.

<version>4.5.14</version>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.2</version>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

httpmime seems to be contained in httpclient5

@mstrankowski mstrankowski merged commit 1a3e44a into master Sep 19, 2023
19 checks passed
@mstrankowski mstrankowski deleted the feature/ACS-6033_migrate_to_spring_boot_3 branch September 19, 2023 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants