mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-05-12 17:04:48 +00:00
Migrated to Spring Boot 3, build completes, was forced to update to httpclient5 from apache. Need to verify no impact on ssl mechanism after changes
This commit is contained in:
parent
1c1ed8724b
commit
1a821500b1
@ -71,8 +71,8 @@
|
|||||||
<artifactId>pooled-jms</artifactId>
|
<artifactId>pooled-jms</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.httpcomponents</groupId>
|
<groupId>org.apache.httpcomponents.client5</groupId>
|
||||||
<artifactId>httpclient</artifactId>
|
<artifactId>httpclient5</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
|
@ -56,7 +56,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||||||
import org.springframework.web.client.HttpClientErrorException;
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
@ -31,9 +31,9 @@ import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
|||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import javax.jms.Destination;
|
import jakarta.jms.Destination;
|
||||||
import javax.jms.JMSException;
|
import jakarta.jms.JMSException;
|
||||||
import javax.jms.Message;
|
import jakarta.jms.Message;
|
||||||
|
|
||||||
import org.alfresco.transform.client.model.TransformReply;
|
import org.alfresco.transform.client.model.TransformReply;
|
||||||
import org.alfresco.transform.client.model.TransformRequest;
|
import org.alfresco.transform.client.model.TransformRequest;
|
||||||
|
@ -34,8 +34,8 @@ import java.io.IOException;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.alfresco.transform.client.model.TransformReply;
|
import org.alfresco.transform.client.model.TransformReply;
|
||||||
import org.alfresco.transform.client.model.TransformRequest;
|
import org.alfresco.transform.client.model.TransformRequest;
|
||||||
|
@ -30,11 +30,11 @@ import static org.alfresco.transformer.fs.FileManager.SOURCE_FILE;
|
|||||||
import static org.alfresco.transformer.fs.FileManager.TARGET_FILE;
|
import static org.alfresco.transformer.fs.FileManager.TARGET_FILE;
|
||||||
import static org.alfresco.transformer.fs.FileManager.deleteFile;
|
import static org.alfresco.transformer.fs.FileManager.deleteFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.alfresco.transformer.logging.LogEntry;
|
import org.alfresco.transformer.logging.LogEntry;
|
||||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
import org.springframework.web.servlet.AsyncHandlerInterceptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
||||||
@ -44,7 +44,7 @@ import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
|||||||
* Handles ThreadLocal Log entries for each request.
|
* Handles ThreadLocal Log entries for each request.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public class TransformInterceptor extends HandlerInterceptorAdapter
|
public class TransformInterceptor implements AsyncHandlerInterceptor
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean preHandle(HttpServletRequest request,
|
public boolean preHandle(HttpServletRequest request,
|
||||||
|
@ -33,7 +33,7 @@ import java.io.IOException;
|
|||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
|
|
||||||
import org.alfresco.transform.config.TransformConfig;
|
import org.alfresco.transform.config.TransformConfig;
|
||||||
import org.alfresco.transform.registry.AbstractTransformRegistry;
|
import org.alfresco.transform.registry.AbstractTransformRegistry;
|
||||||
|
@ -39,6 +39,7 @@ import org.springframework.core.io.FileSystemResource;
|
|||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.http.HttpEntity;
|
import org.springframework.http.HttpEntity;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.util.LinkedMultiValueMap;
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
import org.springframework.web.client.HttpClientErrorException;
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
@ -73,7 +74,7 @@ public class AlfrescoSharedFileStoreClient
|
|||||||
}
|
}
|
||||||
catch (HttpClientErrorException e)
|
catch (HttpClientErrorException e)
|
||||||
{
|
{
|
||||||
throw new TransformException(e.getStatusCode(), e.getMessage(), e);
|
throw new TransformException(HttpStatus.resolve(e.getStatusCode().value()), e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +101,7 @@ public class AlfrescoSharedFileStoreClient
|
|||||||
}
|
}
|
||||||
catch (HttpClientErrorException e)
|
catch (HttpClientErrorException e)
|
||||||
{
|
{
|
||||||
throw new TransformException(e.getStatusCode(), e.getMessage(), e);
|
throw new TransformException(HttpStatus.resolve(e.getStatusCode().value()), e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,12 +26,18 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.transformer.config;
|
package org.alfresco.transformer.config;
|
||||||
|
|
||||||
import org.apache.http.conn.ssl.NoopHostnameVerifier;
|
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
|
||||||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
|
||||||
import org.apache.http.impl.client.CloseableHttpClient;
|
import org.apache.hc.client5.http.impl.classic.HttpClients;
|
||||||
import org.apache.http.impl.client.HttpClientBuilder;
|
import org.apache.hc.client5.http.impl.io.BasicHttpClientConnectionManager;
|
||||||
import org.apache.http.impl.client.HttpClients;
|
import org.apache.hc.client5.http.socket.ConnectionSocketFactory;
|
||||||
import org.apache.http.ssl.SSLContextBuilder;
|
import org.apache.hc.client5.http.ssl.NoopHostnameVerifier;
|
||||||
|
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
|
||||||
|
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactoryBuilder;
|
||||||
|
import org.apache.hc.core5.http.config.Registry;
|
||||||
|
import org.apache.hc.core5.http.config.RegistryBuilder;
|
||||||
|
import org.apache.hc.core5.http.ssl.TLS;
|
||||||
|
import org.apache.hc.core5.ssl.SSLContextBuilder;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@ -40,7 +46,6 @@ import org.springframework.http.client.ClientHttpRequestFactory;
|
|||||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import javax.net.ssl.SSLContext;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.security.KeyManagementException;
|
import java.security.KeyManagementException;
|
||||||
@ -120,11 +125,23 @@ public class MTLSConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private RestTemplate createRestTemplateWithSslContext(SSLContextBuilder sslContextBuilder) throws NoSuchAlgorithmException, KeyManagementException {
|
private RestTemplate createRestTemplateWithSslContext(SSLContextBuilder sslContextBuilder) throws NoSuchAlgorithmException, KeyManagementException {
|
||||||
SSLContext sslContext = sslContextBuilder.build();
|
final SSLConnectionSocketFactoryBuilder sslConnectionSocketFactoryBuilder =
|
||||||
SSLConnectionSocketFactory sslContextFactory = hostNameVerificationDisabled ? new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE)
|
SSLConnectionSocketFactoryBuilder.create()
|
||||||
: new SSLConnectionSocketFactory(sslContext);
|
.setSslContext(sslContextBuilder.build())
|
||||||
|
.setTlsVersions(TLS.V_1_2, TLS.V_1_3);
|
||||||
|
if (hostNameVerificationDisabled) {
|
||||||
|
sslConnectionSocketFactoryBuilder.setHostnameVerifier(NoopHostnameVerifier.INSTANCE);
|
||||||
|
}
|
||||||
|
final SSLConnectionSocketFactory sslConnectionSocketFactory = sslConnectionSocketFactoryBuilder.build();
|
||||||
|
|
||||||
HttpClientBuilder httpClientBuilder = HttpClients.custom().setSSLSocketFactory(sslContextFactory);
|
final Registry<ConnectionSocketFactory> sslSocketFactoryRegistry =
|
||||||
|
RegistryBuilder.<ConnectionSocketFactory> create()
|
||||||
|
.register("https", sslConnectionSocketFactory)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
final BasicHttpClientConnectionManager sslConnectionManager = new BasicHttpClientConnectionManager(sslSocketFactoryRegistry);
|
||||||
|
|
||||||
|
HttpClientBuilder httpClientBuilder = HttpClients.custom().setConnectionManager(sslConnectionManager);
|
||||||
CloseableHttpClient httpClient = httpClientBuilder.build();
|
CloseableHttpClient httpClient = httpClientBuilder.build();
|
||||||
ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient);
|
ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient);
|
||||||
return new RestTemplate(requestFactory);
|
return new RestTemplate(requestFactory);
|
||||||
|
@ -40,7 +40,7 @@ import java.nio.file.Files;
|
|||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.alfresco.transform.exceptions.TransformException;
|
import org.alfresco.transform.exceptions.TransformException;
|
||||||
import org.alfresco.transformer.logging.LogEntry;
|
import org.alfresco.transformer.logging.LogEntry;
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.transformer.messaging;
|
package org.alfresco.transformer.messaging;
|
||||||
|
|
||||||
import javax.jms.ConnectionFactory;
|
import jakarta.jms.ConnectionFactory;
|
||||||
import javax.jms.Queue;
|
import jakarta.jms.Queue;
|
||||||
|
|
||||||
import org.alfresco.transform.messages.TransformRequestValidator;
|
import org.alfresco.transform.messages.TransformRequestValidator;
|
||||||
import org.apache.activemq.command.ActiveMQQueue;
|
import org.apache.activemq.command.ActiveMQQueue;
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.transformer.messaging;
|
package org.alfresco.transformer.messaging;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -39,9 +39,9 @@ import org.springframework.jms.support.converter.MessageType;
|
|||||||
import org.springframework.lang.NonNull;
|
import org.springframework.lang.NonNull;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.jms.JMSException;
|
import jakarta.jms.JMSException;
|
||||||
import javax.jms.Message;
|
import jakarta.jms.Message;
|
||||||
import javax.jms.Session;
|
import jakarta.jms.Session;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.transformer.messaging;
|
package org.alfresco.transformer.messaging;
|
||||||
|
|
||||||
import javax.jms.Destination;
|
import jakarta.jms.Destination;
|
||||||
|
|
||||||
import org.alfresco.transform.client.model.TransformReply;
|
import org.alfresco.transform.client.model.TransformReply;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -42,7 +42,7 @@ import java.nio.file.StandardCopyOption;
|
|||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.alfresco.transform.exceptions.TransformException;
|
import org.alfresco.transform.exceptions.TransformException;
|
||||||
import org.alfresco.transformer.AbstractTransformerController;
|
import org.alfresco.transformer.AbstractTransformerController;
|
||||||
|
@ -36,7 +36,7 @@ import static org.springframework.test.util.AssertionErrors.assertTrue;
|
|||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||||
import org.springframework.boot.web.server.LocalServerPort;
|
import org.springframework.boot.test.web.server.LocalServerPort;
|
||||||
import org.springframework.http.HttpEntity;
|
import org.springframework.http.HttpEntity;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
@ -28,7 +28,7 @@ package org.alfresco.transformer;
|
|||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import javax.jms.Queue;
|
import jakarta.jms.Queue;
|
||||||
|
|
||||||
import org.alfresco.transform.client.model.TransformReply;
|
import org.alfresco.transform.client.model.TransformReply;
|
||||||
import org.alfresco.transform.client.model.TransformRequest;
|
import org.alfresco.transform.client.model.TransformRequest;
|
||||||
|
@ -36,9 +36,9 @@ import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
|||||||
import static org.springframework.http.HttpStatus.CREATED;
|
import static org.springframework.http.HttpStatus.CREATED;
|
||||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||||
|
|
||||||
import javax.jms.Destination;
|
import jakarta.jms.Destination;
|
||||||
import javax.jms.JMSException;
|
import jakarta.jms.JMSException;
|
||||||
import javax.jms.Message;
|
import jakarta.jms.Message;
|
||||||
|
|
||||||
import org.alfresco.transform.client.model.TransformReply;
|
import org.alfresco.transform.client.model.TransformReply;
|
||||||
import org.alfresco.transform.client.model.TransformRequest;
|
import org.alfresco.transform.client.model.TransformRequest;
|
||||||
|
@ -88,13 +88,8 @@
|
|||||||
<artifactId>logback-classic</artifactId>
|
<artifactId>logback-classic</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.httpcomponents</groupId>
|
<groupId>org.apache.httpcomponents.client5</groupId>
|
||||||
<artifactId>httpclient</artifactId>
|
<artifactId>httpclient5</artifactId>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.httpcomponents</groupId>
|
|
||||||
<artifactId>httpmime</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.awaitility</groupId>
|
<groupId>org.awaitility</groupId>
|
||||||
|
@ -57,10 +57,10 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
import javax.jms.Destination;
|
import jakarta.jms.Destination;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -29,12 +29,18 @@ package org.alfresco.transform.base.config;
|
|||||||
import io.netty.handler.ssl.SslContext;
|
import io.netty.handler.ssl.SslContext;
|
||||||
import io.netty.handler.ssl.SslContextBuilder;
|
import io.netty.handler.ssl.SslContextBuilder;
|
||||||
import org.alfresco.transform.base.WebClientBuilderAdjuster;
|
import org.alfresco.transform.base.WebClientBuilderAdjuster;
|
||||||
import org.apache.http.conn.ssl.NoopHostnameVerifier;
|
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
|
||||||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
|
||||||
import org.apache.http.impl.client.CloseableHttpClient;
|
import org.apache.hc.client5.http.impl.classic.HttpClients;
|
||||||
import org.apache.http.impl.client.HttpClientBuilder;
|
import org.apache.hc.client5.http.impl.io.BasicHttpClientConnectionManager;
|
||||||
import org.apache.http.impl.client.HttpClients;
|
import org.apache.hc.client5.http.socket.ConnectionSocketFactory;
|
||||||
import org.apache.http.ssl.SSLContextBuilder;
|
import org.apache.hc.client5.http.ssl.NoopHostnameVerifier;
|
||||||
|
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
|
||||||
|
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactoryBuilder;
|
||||||
|
import org.apache.hc.core5.http.config.Registry;
|
||||||
|
import org.apache.hc.core5.http.config.RegistryBuilder;
|
||||||
|
import org.apache.hc.core5.http.ssl.TLS;
|
||||||
|
import org.apache.hc.core5.ssl.SSLContextBuilder;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@ -46,7 +52,6 @@ import org.springframework.web.client.RestTemplate;
|
|||||||
import reactor.netty.http.client.HttpClient;
|
import reactor.netty.http.client.HttpClient;
|
||||||
|
|
||||||
import javax.net.ssl.KeyManagerFactory;
|
import javax.net.ssl.KeyManagerFactory;
|
||||||
import javax.net.ssl.SSLContext;
|
|
||||||
import javax.net.ssl.SSLEngine;
|
import javax.net.ssl.SSLEngine;
|
||||||
import javax.net.ssl.SSLException;
|
import javax.net.ssl.SSLException;
|
||||||
import javax.net.ssl.SSLParameters;
|
import javax.net.ssl.SSLParameters;
|
||||||
@ -179,11 +184,23 @@ public class MTLSConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private RestTemplate createRestTemplateWithSslContext(SSLContextBuilder sslContextBuilder) throws NoSuchAlgorithmException, KeyManagementException {
|
private RestTemplate createRestTemplateWithSslContext(SSLContextBuilder sslContextBuilder) throws NoSuchAlgorithmException, KeyManagementException {
|
||||||
SSLContext sslContext = sslContextBuilder.build();
|
final SSLConnectionSocketFactoryBuilder sslConnectionSocketFactoryBuilder =
|
||||||
SSLConnectionSocketFactory sslContextFactory = hostNameVerificationDisabled ? new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE)
|
SSLConnectionSocketFactoryBuilder.create()
|
||||||
: new SSLConnectionSocketFactory(sslContext);
|
.setSslContext(sslContextBuilder.build())
|
||||||
|
.setTlsVersions(TLS.V_1_2, TLS.V_1_3);
|
||||||
|
if (hostNameVerificationDisabled) {
|
||||||
|
sslConnectionSocketFactoryBuilder.setHostnameVerifier(NoopHostnameVerifier.INSTANCE);
|
||||||
|
}
|
||||||
|
final SSLConnectionSocketFactory sslConnectionSocketFactory = sslConnectionSocketFactoryBuilder.build();
|
||||||
|
|
||||||
HttpClientBuilder httpClientBuilder = HttpClients.custom().setSSLSocketFactory(sslContextFactory);
|
final Registry<ConnectionSocketFactory> sslSocketFactoryRegistry =
|
||||||
|
RegistryBuilder.<ConnectionSocketFactory> create()
|
||||||
|
.register("https", sslConnectionSocketFactory)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
final BasicHttpClientConnectionManager sslConnectionManager = new BasicHttpClientConnectionManager(sslSocketFactoryRegistry);
|
||||||
|
|
||||||
|
HttpClientBuilder httpClientBuilder = HttpClients.custom().setConnectionManager(sslConnectionManager);
|
||||||
CloseableHttpClient httpClient = httpClientBuilder.build();
|
CloseableHttpClient httpClient = httpClientBuilder.build();
|
||||||
ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient);
|
ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient);
|
||||||
return new RestTemplate(requestFactory);
|
return new RestTemplate(requestFactory);
|
||||||
|
@ -35,7 +35,7 @@ import org.springframework.http.ResponseEntity;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import org.springframework.web.util.UriUtils;
|
import org.springframework.web.util.UriUtils;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -30,11 +30,10 @@ import static org.alfresco.transform.base.fs.FileManager.SOURCE_FILE;
|
|||||||
import static org.alfresco.transform.base.fs.FileManager.TARGET_FILE;
|
import static org.alfresco.transform.base.fs.FileManager.TARGET_FILE;
|
||||||
import static org.alfresco.transform.base.fs.FileManager.deleteFile;
|
import static org.alfresco.transform.base.fs.FileManager.deleteFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.springframework.web.servlet.AsyncHandlerInterceptor;
|
import org.springframework.web.servlet.AsyncHandlerInterceptor;
|
||||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleans up temporary files in transform requests that upload the content and download the result.
|
* Cleans up temporary files in transform requests that upload the content and download the result.
|
||||||
|
@ -40,8 +40,8 @@ import org.springframework.lang.NonNull;
|
|||||||
import org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory;
|
import org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory;
|
||||||
import org.springframework.transaction.PlatformTransactionManager;
|
import org.springframework.transaction.PlatformTransactionManager;
|
||||||
|
|
||||||
import javax.jms.ConnectionFactory;
|
import jakarta.jms.ConnectionFactory;
|
||||||
import javax.jms.Queue;
|
import jakarta.jms.Queue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JMS and messaging configuration for the T-Engines. Contains the basic config in order to have the
|
* JMS and messaging configuration for the T-Engines. Contains the basic config in order to have the
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.transform.base.messaging;
|
package org.alfresco.transform.base.messaging;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -39,9 +39,9 @@ import org.springframework.jms.annotation.JmsListener;
|
|||||||
import org.springframework.jms.support.converter.MessageConversionException;
|
import org.springframework.jms.support.converter.MessageConversionException;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.jms.Destination;
|
import jakarta.jms.Destination;
|
||||||
import javax.jms.JMSException;
|
import jakarta.jms.JMSException;
|
||||||
import javax.jms.Message;
|
import jakarta.jms.Message;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||||
|
@ -39,9 +39,9 @@ import org.springframework.jms.support.converter.MessageType;
|
|||||||
import org.springframework.lang.NonNull;
|
import org.springframework.lang.NonNull;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.jms.JMSException;
|
import jakarta.jms.JMSException;
|
||||||
import javax.jms.Message;
|
import jakarta.jms.Message;
|
||||||
import javax.jms.Session;
|
import jakarta.jms.Session;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copied from the t-router. We would need to create a common dependency between t-engine base and t-router that
|
* Copied from the t-router. We would need to create a common dependency between t-engine base and t-router that
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.transform.base.messaging;
|
package org.alfresco.transform.base.messaging;
|
||||||
|
|
||||||
import javax.jms.Destination;
|
import jakarta.jms.Destination;
|
||||||
|
|
||||||
import org.alfresco.transform.client.model.TransformReply;
|
import org.alfresco.transform.client.model.TransformReply;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -35,7 +35,7 @@ import org.springframework.core.io.FileSystemResource;
|
|||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -32,7 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,6 +45,7 @@ import org.springframework.core.io.FileSystemResource;
|
|||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.http.HttpEntity;
|
import org.springframework.http.HttpEntity;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -53,7 +54,7 @@ import org.springframework.web.client.HttpClientErrorException;
|
|||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
import org.springframework.web.reactive.function.client.WebClient;
|
import org.springframework.web.reactive.function.client.WebClient;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
import javax.net.ssl.SSLException;
|
import javax.net.ssl.SSLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -100,7 +101,7 @@ public class SharedFileStoreClient
|
|||||||
}
|
}
|
||||||
catch (HttpClientErrorException e)
|
catch (HttpClientErrorException e)
|
||||||
{
|
{
|
||||||
throw new TransformException(e.getStatusCode(), e.getMessage(), e);
|
throw new TransformException(HttpStatus.resolve(e.getStatusCode().value()), e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +128,7 @@ public class SharedFileStoreClient
|
|||||||
}
|
}
|
||||||
catch (HttpClientErrorException e)
|
catch (HttpClientErrorException e)
|
||||||
{
|
{
|
||||||
throw new TransformException(e.getStatusCode(), e.getMessage(), e);
|
throw new TransformException(HttpStatus.resolve(e.getStatusCode().value()), e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ import org.alfresco.transform.common.TransformerDebug;
|
|||||||
import org.alfresco.transform.registry.TransformServiceRegistry;
|
import org.alfresco.transform.registry.TransformServiceRegistry;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.jms.Destination;
|
import jakarta.jms.Destination;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -52,8 +52,8 @@ import org.springframework.validation.Errors;
|
|||||||
import org.springframework.web.client.HttpClientErrorException;
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.jms.Destination;
|
import jakarta.jms.Destination;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -372,7 +372,7 @@ public class TransformHandler
|
|||||||
}
|
}
|
||||||
catch (HttpClientErrorException e)
|
catch (HttpClientErrorException e)
|
||||||
{
|
{
|
||||||
throw new TransformException(e.getStatusCode(), messageWithCause("Failed to read the source from the SFS", e));
|
throw new TransformException(HttpStatus.resolve(e.getStatusCode().value()), messageWithCause("Failed to read the source from the SFS", e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,7 +394,7 @@ public class TransformHandler
|
|||||||
}
|
}
|
||||||
catch (HttpClientErrorException e)
|
catch (HttpClientErrorException e)
|
||||||
{
|
{
|
||||||
throw new TransformException(e.getStatusCode(), messageWithCause(FAILED_WRITING_TO_SFS, e));
|
throw new TransformException(HttpStatus.resolve(e.getStatusCode().value()), messageWithCause(FAILED_WRITING_TO_SFS, e));
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -1,10 +1,17 @@
|
|||||||
package org.alfresco.transform.base;
|
package org.alfresco.transform.base;
|
||||||
|
|
||||||
import org.apache.http.conn.ssl.NoopHostnameVerifier;
|
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
|
||||||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
|
import org.apache.hc.client5.http.impl.classic.HttpClients;
|
||||||
import org.apache.http.impl.client.CloseableHttpClient;
|
import org.apache.hc.client5.http.impl.io.BasicHttpClientConnectionManager;
|
||||||
import org.apache.http.impl.client.HttpClients;
|
import org.apache.hc.client5.http.io.HttpClientConnectionManager;
|
||||||
import org.apache.http.ssl.SSLContextBuilder;
|
import org.apache.hc.client5.http.socket.ConnectionSocketFactory;
|
||||||
|
import org.apache.hc.client5.http.ssl.NoopHostnameVerifier;
|
||||||
|
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
|
||||||
|
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactoryBuilder;
|
||||||
|
import org.apache.hc.core5.http.config.Registry;
|
||||||
|
import org.apache.hc.core5.http.config.RegistryBuilder;
|
||||||
|
import org.apache.hc.core5.http.ssl.TLS;
|
||||||
|
import org.apache.hc.core5.ssl.SSLContextBuilder;
|
||||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
@ -59,10 +66,26 @@ public class MtlsTestUtils {
|
|||||||
.loadTrustMaterial(trustStore, trustStorePassword);
|
.loadTrustMaterial(trustStore, trustStorePassword);
|
||||||
|
|
||||||
SSLContext sslContext = sslContextBuilder.build();
|
SSLContext sslContext = sslContextBuilder.build();
|
||||||
SSLConnectionSocketFactory sslContextFactory = HOSTNAME_VERIFICATION_DISABLED ? new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE)
|
|
||||||
: new SSLConnectionSocketFactory(sslContext);
|
|
||||||
|
|
||||||
return HttpClients.custom().setSSLSocketFactory(sslContextFactory).build();
|
return HttpClients.custom().setConnectionManager(buildSslConnectionManager(sslContext)).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static HttpClientConnectionManager buildSslConnectionManager(SSLContext sslContext) {
|
||||||
|
final SSLConnectionSocketFactoryBuilder sslConnectionSocketFactoryBuilder =
|
||||||
|
SSLConnectionSocketFactoryBuilder.create()
|
||||||
|
.setSslContext(sslContext)
|
||||||
|
.setTlsVersions(TLS.V_1_2, TLS.V_1_3);
|
||||||
|
if (HOSTNAME_VERIFICATION_DISABLED) {
|
||||||
|
sslConnectionSocketFactoryBuilder.setHostnameVerifier(NoopHostnameVerifier.INSTANCE);
|
||||||
|
}
|
||||||
|
final SSLConnectionSocketFactory sslConnectionSocketFactory = sslConnectionSocketFactoryBuilder.build();
|
||||||
|
|
||||||
|
final Registry<ConnectionSocketFactory> sslSocketFactoryRegistry =
|
||||||
|
RegistryBuilder.<ConnectionSocketFactory> create()
|
||||||
|
.register("https", sslConnectionSocketFactory)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
return new BasicHttpClientConnectionManager(sslSocketFactoryRegistry);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RestTemplate restTemplateWithMtls()
|
public static RestTemplate restTemplateWithMtls()
|
||||||
|
@ -8,15 +8,15 @@
|
|||||||
|
|
||||||
package org.alfresco.transform.base.clients;
|
package org.alfresco.transform.base.clients;
|
||||||
|
|
||||||
import javax.jms.BytesMessage;
|
import jakarta.jms.BytesMessage;
|
||||||
import javax.jms.Connection;
|
import jakarta.jms.Connection;
|
||||||
import javax.jms.ConnectionFactory;
|
import jakarta.jms.ConnectionFactory;
|
||||||
import javax.jms.DeliveryMode;
|
import jakarta.jms.DeliveryMode;
|
||||||
import javax.jms.Destination;
|
import jakarta.jms.Destination;
|
||||||
import javax.jms.MessageConsumer;
|
import jakarta.jms.MessageConsumer;
|
||||||
import javax.jms.MessageProducer;
|
import jakarta.jms.MessageProducer;
|
||||||
import javax.jms.Session;
|
import jakarta.jms.Session;
|
||||||
import javax.jms.TextMessage;
|
import jakarta.jms.TextMessage;
|
||||||
|
|
||||||
import org.alfresco.transform.client.model.TransformReply;
|
import org.alfresco.transform.client.model.TransformReply;
|
||||||
import org.alfresco.transform.client.model.TransformRequest;
|
import org.alfresco.transform.client.model.TransformRequest;
|
||||||
|
@ -22,17 +22,18 @@ import java.nio.file.Paths;
|
|||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
|
|
||||||
import org.alfresco.transform.base.MtlsTestUtils;
|
import org.alfresco.transform.base.MtlsTestUtils;
|
||||||
import org.apache.http.HttpEntity;
|
import org.apache.hc.client5.http.classic.methods.HttpGet;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.hc.client5.http.classic.methods.HttpHead;
|
||||||
import org.apache.http.client.methods.HttpGet;
|
import org.apache.hc.client5.http.classic.methods.HttpPost;
|
||||||
import org.apache.http.client.methods.HttpHead;
|
import org.apache.hc.client5.http.entity.mime.FileBody;
|
||||||
import org.apache.http.client.methods.HttpPost;
|
import org.apache.hc.client5.http.entity.mime.HttpMultipartMode;
|
||||||
import org.apache.http.entity.ContentType;
|
import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder;
|
||||||
import org.apache.http.entity.mime.HttpMultipartMode;
|
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
|
||||||
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
import org.apache.hc.core5.http.ContentType;
|
||||||
import org.apache.http.entity.mime.content.FileBody;
|
import org.apache.hc.core5.http.HttpEntity;
|
||||||
import org.apache.http.impl.client.CloseableHttpClient;
|
import org.apache.hc.core5.http.HttpEntityContainer;
|
||||||
import org.apache.http.util.EntityUtils;
|
import org.apache.hc.core5.http.HttpResponse;
|
||||||
|
import org.apache.hc.core5.http.io.entity.EntityUtils;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
@ -71,17 +72,17 @@ public class SfsClient
|
|||||||
sfsBaseUrl+"/alfresco/api/-default-/private/sfs/versions/1/file");
|
sfsBaseUrl+"/alfresco/api/-default-/private/sfs/versions/1/file");
|
||||||
post.setEntity(MultipartEntityBuilder
|
post.setEntity(MultipartEntityBuilder
|
||||||
.create()
|
.create()
|
||||||
.setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
|
.setMode(HttpMultipartMode.LEGACY)
|
||||||
.addPart("file", new FileBody(file, ContentType.DEFAULT_BINARY))
|
.addPart("file", new FileBody(file, ContentType.DEFAULT_BINARY))
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
try (CloseableHttpClient client = MtlsTestUtils.getHttpClient())
|
try (CloseableHttpClient client = MtlsTestUtils.getHttpClient())
|
||||||
{
|
{
|
||||||
final HttpResponse response = client.execute(post);
|
final HttpResponse response = client.execute(post);
|
||||||
int status = response.getStatusLine().getStatusCode();
|
int status = response.getCode();
|
||||||
if (status >= 200 && status < 300)
|
if (status >= 200 && status < 300)
|
||||||
{
|
{
|
||||||
return JacksonSerializer.readStringValue(EntityUtils.toString(response.getEntity()),
|
return JacksonSerializer.readStringValue(EntityUtils.toString(((HttpEntityContainer) response).getEntity()),
|
||||||
"entry.fileRef");
|
"entry.fileRef");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -137,7 +138,7 @@ public class SfsClient
|
|||||||
try (CloseableHttpClient client = MtlsTestUtils.getHttpClient())
|
try (CloseableHttpClient client = MtlsTestUtils.getHttpClient())
|
||||||
{
|
{
|
||||||
final HttpResponse response = client.execute(head);
|
final HttpResponse response = client.execute(head);
|
||||||
final int status = response.getStatusLine().getStatusCode();
|
final int status = response.getCode();
|
||||||
return status >= 200 && status < 300;
|
return status >= 200 && status < 300;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -156,12 +157,12 @@ public class SfsClient
|
|||||||
try (CloseableHttpClient client = MtlsTestUtils.getHttpClient())
|
try (CloseableHttpClient client = MtlsTestUtils.getHttpClient())
|
||||||
{
|
{
|
||||||
final HttpResponse response = client.execute(get);
|
final HttpResponse response = client.execute(get);
|
||||||
final int status = response.getStatusLine().getStatusCode();
|
final int status = response.getCode();
|
||||||
if (status < 200 || status >= 300)
|
if (status < 200 || status >= 300)
|
||||||
{
|
{
|
||||||
throw new Exception("File with UUID " + uuid + " was not found on SFS");
|
throw new Exception("File with UUID " + uuid + " was not found on SFS");
|
||||||
}
|
}
|
||||||
final HttpEntity entity = response.getEntity();
|
final HttpEntity entity = ((HttpEntityContainer) response).getEntity();
|
||||||
if (entity == null)
|
if (entity == null)
|
||||||
{
|
{
|
||||||
throw new Exception("Failed to read HTTP reply entity for file with UUID " + uuid);
|
throw new Exception("Failed to read HTTP reply entity for file with UUID " + uuid);
|
||||||
|
@ -28,7 +28,7 @@ package org.alfresco.transform.base.messaging;
|
|||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import javax.jms.Queue;
|
import jakarta.jms.Queue;
|
||||||
|
|
||||||
import org.alfresco.transform.client.model.TransformReply;
|
import org.alfresco.transform.client.model.TransformReply;
|
||||||
import org.alfresco.transform.client.model.TransformRequest;
|
import org.alfresco.transform.client.model.TransformRequest;
|
||||||
|
@ -38,9 +38,9 @@ import org.mockito.Mock;
|
|||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.jms.support.converter.MessageConversionException;
|
import org.springframework.jms.support.converter.MessageConversionException;
|
||||||
|
|
||||||
import javax.jms.Destination;
|
import jakarta.jms.Destination;
|
||||||
import javax.jms.JMSException;
|
import jakarta.jms.JMSException;
|
||||||
import javax.jms.Message;
|
import jakarta.jms.Message;
|
||||||
|
|
||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.doAnswer;
|
||||||
import static org.mockito.Mockito.doReturn;
|
import static org.mockito.Mockito.doReturn;
|
||||||
|
@ -51,7 +51,7 @@ import org.springframework.test.context.ContextConfiguration;
|
|||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||||
|
|
||||||
import javax.jms.Destination;
|
import jakarta.jms.Destination;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -52,7 +52,7 @@ import static org.alfresco.transform.common.RequestParamMap.START_PAGE;
|
|||||||
import static org.alfresco.transform.common.RequestParamMap.THUMBNAIL;
|
import static org.alfresco.transform.common.RequestParamMap.THUMBNAIL;
|
||||||
import static org.alfresco.transform.common.RequestParamMap.TIMEOUT;
|
import static org.alfresco.transform.common.RequestParamMap.TIMEOUT;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -34,8 +34,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
import javax.annotation.PreDestroy;
|
import jakarta.annotation.PreDestroy;
|
||||||
|
|
||||||
import org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration;
|
import org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration;
|
||||||
import org.artofsolving.jodconverter.office.OfficeException;
|
import org.artofsolving.jodconverter.office.OfficeException;
|
||||||
|
@ -44,7 +44,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
@ -72,9 +72,9 @@
|
|||||||
|
|
||||||
<!-- EMLTransformer -->
|
<!-- EMLTransformer -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sun.mail</groupId>
|
<groupId>jakarta.mail</groupId>
|
||||||
<artifactId>javax.mail</artifactId>
|
<artifactId>jakarta.mail-api</artifactId>
|
||||||
<version>1.6.2</version>
|
<version>2.1.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -32,11 +32,11 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.mail.Header;
|
import jakarta.mail.Header;
|
||||||
import javax.mail.internet.InternetAddress;
|
import jakarta.mail.internet.InternetAddress;
|
||||||
import javax.mail.internet.MimeMessage;
|
import jakarta.mail.internet.MimeMessage;
|
||||||
import javax.mail.internet.MimeMessage.RecipientType;
|
import jakarta.mail.internet.MimeMessage.RecipientType;
|
||||||
import javax.mail.internet.MimeUtility;
|
import jakarta.mail.internet.MimeUtility;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
@ -33,11 +33,11 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.mail.MessagingException;
|
import jakarta.mail.MessagingException;
|
||||||
import javax.mail.Multipart;
|
import jakarta.mail.Multipart;
|
||||||
import javax.mail.Part;
|
import jakarta.mail.Part;
|
||||||
import javax.mail.Session;
|
import jakarta.mail.Session;
|
||||||
import javax.mail.internet.MimeMessage;
|
import jakarta.mail.internet.MimeMessage;
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -35,7 +35,7 @@ import org.alfresco.transform.pdfrenderer.PdfRendererOptionsBuilder;
|
|||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
13
pom.xml
13
pom.xml
@ -10,7 +10,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>2.7.14</version>
|
<version>3.1.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@ -220,14 +220,9 @@
|
|||||||
<version>1.16.0</version>
|
<version>1.16.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.httpcomponents</groupId>
|
<groupId>org.apache.httpcomponents.client5</groupId>
|
||||||
<artifactId>httpclient</artifactId>
|
<artifactId>httpclient5</artifactId>
|
||||||
<version>4.5.14</version>
|
<version>5.2</version>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.httpcomponents</groupId>
|
|
||||||
<artifactId>httpmime</artifactId>
|
|
||||||
<version>4.5.14</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.yaml</groupId>
|
<groupId>org.yaml</groupId>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user