import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
+import java.util.UUID;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
protected Logger logger;
protected String accept;
protected String contentType;
+ protected UUID requestId;
- protected RestClient(RestProperties props, Optional<URI> path) {
+ protected RestClient(RestProperties props, UUID requestId, Optional<URI> path) {
logger = Logger.getLogger(getClass().getName());
msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
-
+ this.requestId = requestId;
headerMap = new HashMap<>();
try {
host = props.getEndpoint();
initializeClient(getClient());
}
- protected RestClient(RestProperties props, Optional<URI> path, String accept, String contentType) {
- this(props, path);
+ protected RestClient(RestProperties props, UUID requestId, Optional<URI> path, String accept, String contentType) {
+ this(props, requestId, path);
this.accept = accept;
this.contentType = contentType;
+ this.requestId = requestId;
}
- protected RestClient(URL host, String contentType) {
+ protected RestClient(URL host, UUID requestId, String contentType) {
headerMap = new HashMap<>();
logger = Logger.getLogger(getClass().getName());
msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
this.path = Optional.empty();
this.host = host;
this.contentType = contentType;
+ this.requestId = requestId;
initializeClient(getClient());
}
protected abstract Optional<ClientResponseFilter> addResponseFilter();
- public abstract RestClient addRequestId(String requestId);
+ public abstract RestClient addRequestId(UUID requestId);
protected ContextResolver<ObjectMapper> getMapper() {
return new CommonObjectMapperProvider();
return ClientBuilder.newBuilder().build();
}
+ protected UUID getRequestId() {
+ return this.requestId;
+ }
protected void initializeClient(Client client) {
if (this.enableLogging()) {
client.register(logger).register(new LoggingFilter(this.getMaxPayloadSize()));