-
Notifications
You must be signed in to change notification settings - Fork 24
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
Migrated to Spring Boot 3 #862
Conversation
…ttpclient5 from apache. Need to verify no impact on ssl mechanism after changes
… only the API itself
@@ -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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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 = |
There was a problem hiding this comment.
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)}"> |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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()), |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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
…ways, no need to declare it separately
compiles, I was forced to update to httpclient5 from apache. Need to verify no impact on ssl mechanism after changes