All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.genesys.provisioning.ClientTransport Maven / Gradle / Ivy

There is a newer version: 9.0.75
Show newest version
package com.genesys.provisioning;

import java.util.HashMap;
import org.cometd.client.transport.LongPollingTransport;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.Request;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class ClientTransport extends LongPollingTransport {
    
    private static final Logger logger = LoggerFactory.getLogger(ClientTransport.class);
    
    private final TraceInterceptor interceptor = new TraceInterceptor();
    private final String apiKey;

    public ClientTransport(String apiKey, HttpClient httpClient) {
        super(new HashMap(), httpClient);
        
        this.apiKey = apiKey;
    }
    
    @Override
    protected void customize(Request request) {
        request.header("x-api-key", apiKey);
        request.header(TraceInterceptor.TRACEID_HEADER, interceptor.makeUniqueId());
        request.header(TraceInterceptor.SPANID_HEADER, interceptor.makeUniqueId());

		logger.debug(request.toString());
        logger.debug(request.getHeaders().toString());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy