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

com.undefinedlabs.scope.rules.propagation.carriers.HttpAkkaRequestExtractAdapter Maven / Gradle / Ivy

package com.undefinedlabs.scope.rules.propagation.carriers;


import akka.http.javadsl.model.HttpHeader;
import akka.http.scaladsl.model.HttpRequest;
import io.opentracing.propagation.TextMap;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class HttpAkkaRequestExtractAdapter implements TextMap {

    private Map headers;

    public HttpAkkaRequestExtractAdapter(final HttpRequest request) {
        this.headers = new HashMap<>();
        for (final HttpHeader header : request.getHeaders()) {
            this.headers.put(header.name(), header.value());
        }
    }

    @Override
    public Iterator> iterator() {
        return this.headers.entrySet().iterator();
    }

    @Override
    public void put(String s, String s1) {
        throw new UnsupportedOperationException("This class should be used only with Tracer.extract()!");
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy