Search in sources :

Example 1 with HttpHeader

use of akka.http.javadsl.model.HttpHeader in project pinpoint by naver.

the class HttpRequestAdaptor method getHeaderNames.

@Override
public Collection<String> getHeaderNames(HttpRequest request) {
    if (request == null) {
        return Collections.emptyList();
    }
    final Iterable<HttpHeader> headers = request.getHeaders();
    if (headers == null) {
        return Collections.emptyList();
    }
    List<String> names = new ArrayList<>();
    for (HttpHeader header : headers) {
        names.add(header.name());
    }
    return names;
}
Also used : HttpHeader(akka.http.javadsl.model.HttpHeader) ArrayList(java.util.ArrayList)

Example 2 with HttpHeader

use of akka.http.javadsl.model.HttpHeader in project pinpoint by naver.

the class HttpRequestAdaptor method getHeader.

private String getHeader(HttpRequest request, String name, String defaultValue) {
    if (request == null) {
        return defaultValue;
    }
    Optional<HttpHeader> optional = request.getHeader(name);
    if (optional == null) {
        return defaultValue;
    }
    HttpHeader header = optional.orElse(null);
    if (header == null) {
        return defaultValue;
    }
    String value = header.value();
    if (value == null) {
        return defaultValue;
    }
    return value;
}
Also used : HttpHeader(akka.http.javadsl.model.HttpHeader)

Example 3 with HttpHeader

use of akka.http.javadsl.model.HttpHeader in project pinpoint by pinpoint-apm.

the class HttpRequestAdaptor method getHeaderNames.

@Override
public Collection<String> getHeaderNames(HttpRequest request) {
    if (request == null) {
        return Collections.emptyList();
    }
    final Iterable<HttpHeader> headers = request.getHeaders();
    if (headers == null) {
        return Collections.emptyList();
    }
    List<String> names = new ArrayList<>();
    for (HttpHeader header : headers) {
        names.add(header.name());
    }
    return names;
}
Also used : HttpHeader(akka.http.javadsl.model.HttpHeader) ArrayList(java.util.ArrayList)

Example 4 with HttpHeader

use of akka.http.javadsl.model.HttpHeader in project pinpoint by pinpoint-apm.

the class HttpRequestAdaptor method getHeader.

private String getHeader(HttpRequest request, String name, String defaultValue) {
    if (request == null) {
        return defaultValue;
    }
    Optional<HttpHeader> optional = request.getHeader(name);
    if (optional == null) {
        return defaultValue;
    }
    HttpHeader header = optional.orElse(null);
    if (header == null) {
        return defaultValue;
    }
    String value = header.value();
    if (value == null) {
        return defaultValue;
    }
    return value;
}
Also used : HttpHeader(akka.http.javadsl.model.HttpHeader)

Aggregations

HttpHeader (akka.http.javadsl.model.HttpHeader)4 ArrayList (java.util.ArrayList)2