ru.tinkoff.kora.http.client.async.AsyncHttpClientHeaders Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of http-client-async Show documentation
Show all versions of http-client-async Show documentation
Kora http-client-async module
The newest version!
package ru.tinkoff.kora.http.client.async;
import jakarta.annotation.Nonnull;
import jakarta.annotation.Nullable;
import ru.tinkoff.kora.http.common.header.AbstractHttpHeaders;
import ru.tinkoff.kora.http.common.header.HttpHeaders;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class AsyncHttpClientHeaders extends AbstractHttpHeaders implements HttpHeaders {
private final io.netty.handler.codec.http.HttpHeaders headers;
public AsyncHttpClientHeaders(io.netty.handler.codec.http.HttpHeaders headers) {
this.headers = headers;
}
@Nullable
@Override
public String getFirst(String headerName) {
return this.headers.get(headerName);
}
@Override
public List getAll(String headerName) {
return this.headers.getAll(headerName);
}
@Override
public boolean has(String headerName) {
return headers.contains(headerName);
}
@Override
public int size() {
return this.headers.size();
}
@Override
public Set names() {
return headers.names();
}
@Nonnull
@Override
public Iterator>> iterator() {
var i = this.headers.names().iterator();
this.headers.getAll(i.next());
return new Iterator<>() {
@Override
public boolean hasNext() {
return i.hasNext();
}
@Override
public Map.Entry> next() {
var key = i.next();
var values = headers.getAll(key);
return Map.entry(key.toLowerCase(), values);
}
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy