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

com.github.kristofa.brave.http.HttpServerResponseAdapter Maven / Gradle / Ivy

Go to download

Abstraction that makes it easier to implement brave in http clients and servers.

The newest version!
package com.github.kristofa.brave.http;

import com.github.kristofa.brave.KeyValueAnnotation;
import com.github.kristofa.brave.ServerResponseAdapter;
import com.github.kristofa.brave.TraceKeys;

import java.util.Arrays;
import java.util.Collection;

public class HttpServerResponseAdapter implements ServerResponseAdapter {

    private final HttpResponse response;

    public HttpServerResponseAdapter(HttpResponse response)
    {
        this.response = response;
    }

    @Override
    public Collection responseAnnotations() {
        KeyValueAnnotation statusAnnotation = KeyValueAnnotation.create(
                TraceKeys.HTTP_STATUS_CODE, String.valueOf(response.getHttpStatusCode()));
        return Arrays.asList(statusAnnotation);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy