Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt to new Netty5 Header API #2484

Merged
merged 7 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
package reactor.netty5;

import io.netty5.buffer.BufferInputStream;
import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.api.BufferAllocator;
import io.netty5.buffer.api.CompositeBuffer;
import io.netty5.buffer.Buffer;
import io.netty5.buffer.BufferAllocator;
import io.netty5.buffer.CompositeBuffer;
import io.netty5.util.Send;
import io.netty5.channel.socket.DatagramPacket;
import io.netty5.handler.codec.http.HttpContent;
Expand All @@ -39,7 +39,7 @@
import java.util.Objects;
import java.util.function.Function;

import static io.netty5.buffer.api.DefaultBufferAllocators.preferredAllocator;
import static io.netty5.buffer.DefaultBufferAllocators.preferredAllocator;

/**
* A decorating {@link Flux} {@link NettyInbound} with various {@link Buffer} related
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
package reactor.netty5;

import io.netty5.buffer.BufferInputStream;
import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.api.BufferAllocator;
import io.netty5.buffer.api.CompositeBuffer;
import io.netty5.buffer.Buffer;
import io.netty5.buffer.BufferAllocator;
import io.netty5.buffer.CompositeBuffer;
import org.reactivestreams.Publisher;
import reactor.core.CoreSubscriber;
import reactor.core.Fuseable;
Expand All @@ -30,7 +30,7 @@
import java.nio.charset.Charset;
import java.util.Objects;

import static io.netty5.buffer.api.DefaultBufferAllocators.preferredAllocator;
import static io.netty5.buffer.DefaultBufferAllocators.preferredAllocator;
import static java.util.Objects.requireNonNull;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
import java.util.function.Consumer;
import java.util.function.Predicate;

import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.api.BufferAllocator;
import io.netty5.buffer.Buffer;
import io.netty5.buffer.BufferAllocator;
import io.netty5.channel.Channel;
import io.netty5.channel.DefaultFileRegion;
import io.netty5.handler.stream.ChunkedNioFile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
import io.netty.buffer.ByteBufUtil;
import io.netty.buffer.Unpooled;
import io.netty5.buffer.BufferUtil;
import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.api.BufferAllocator;
import io.netty5.buffer.api.BufferHolder;
import io.netty5.buffer.Buffer;
import io.netty5.buffer.BufferAllocator;
import io.netty5.buffer.BufferHolder;
import io.netty5.channel.nio.AbstractNioChannel;
import io.netty5.util.Resource;
import io.netty5.channel.Channel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package reactor.netty5.channel;

import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.Buffer;
import io.netty5.channel.ChannelHandler;
import io.netty5.channel.ChannelHandlerAdapter;
import io.netty5.channel.ChannelHandlerContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import java.util.function.Consumer;
import java.util.function.Predicate;

import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.api.BufferAllocator;
import io.netty5.buffer.Buffer;
import io.netty5.buffer.BufferAllocator;
import io.netty5.util.Resource;
import io.netty5.channel.Channel;
import io.netty5.channel.ChannelHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package reactor.netty5.channel;

import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.Buffer;
import io.netty5.util.Resource;
import io.netty5.channel.ChannelHandlerAdapter;
import io.netty5.channel.ChannelHandlerContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.util.function.ToIntFunction;

import io.netty.buffer.ByteBufHolder;
import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.Buffer;
import io.netty5.util.Resource;
import io.netty5.channel.Channel;
import io.netty5.channel.ChannelHandlerContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import java.util.stream.Stream;

import io.netty.buffer.ByteBufHolder;
import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.Buffer;
import io.netty5.util.Resource;
import io.netty5.channel.Channel;
import io.netty5.channel.ChannelHandlerContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

import io.micrometer.core.instrument.Gauge;
import io.micrometer.core.instrument.Tags;
import io.netty5.buffer.api.BufferAllocator;
import io.netty5.buffer.api.pool.BufferAllocatorMetric;
import io.netty5.buffer.BufferAllocator;
import io.netty5.buffer.pool.BufferAllocatorMetric;
import reactor.netty5.internal.util.MapUtils;

import java.util.concurrent.ConcurrentHashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.Objects;
import java.util.function.Supplier;

import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.Buffer;
import io.netty5.channel.ChannelOption;
import io.netty5.channel.EventLoopGroup;
import io.netty5.channel.group.ChannelGroup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import java.util.Objects;
import java.util.function.Supplier;

import io.netty5.buffer.api.BufferAllocator;
import io.netty5.buffer.api.pool.BufferAllocatorMetricProvider;
import io.netty5.buffer.BufferAllocator;
import io.netty5.buffer.pool.BufferAllocatorMetricProvider;
import io.netty5.channel.Channel;
import io.netty5.channel.ChannelFactory;
import io.netty5.channel.ChannelInitializer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.nio.charset.Charset;

import io.netty.buffer.ByteBufHolder;
import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.Buffer;
import io.netty5.handler.logging.LogLevel;
import io.netty5.handler.logging.LoggingHandler;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufHolder;
import io.netty5.buffer.BufferUtil;
import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.Buffer;
import io.netty5.channel.Channel;
import io.netty5.channel.ChannelHandlerContext;
import io.netty5.handler.logging.BufferFormat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package reactor.netty5;

import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.Buffer;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
Expand All @@ -37,7 +37,7 @@
import java.util.Random;
import java.util.stream.Collectors;

import static io.netty5.buffer.api.DefaultBufferAllocators.preferredAllocator;
import static io.netty5.buffer.DefaultBufferAllocators.preferredAllocator;
import static org.assertj.core.api.Assertions.assertThat;

class BufferFluxTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package reactor.netty5;

import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.Buffer;
import org.junit.jupiter.api.Test;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
Expand All @@ -27,7 +27,7 @@
import java.util.Arrays;
import java.util.Random;

import static io.netty5.buffer.api.DefaultBufferAllocators.preferredAllocator;
import static io.netty5.buffer.DefaultBufferAllocators.preferredAllocator;

class BufferMonoTest {
static final Random rndm = new Random();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
import java.util.function.Predicate;
import javax.net.ssl.SSLException;

import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.api.BufferAllocator;
import io.netty5.buffer.Buffer;
import io.netty5.buffer.BufferAllocator;
import io.netty5.channel.ChannelHandlerContext;
import io.netty5.channel.DefaultFileRegion;
import io.netty5.channel.FileRegion;
Expand All @@ -53,7 +53,7 @@
import org.reactivestreams.Publisher;
import reactor.core.publisher.Mono;

import static io.netty5.buffer.api.DefaultBufferAllocators.preferredAllocator;
import static io.netty5.buffer.DefaultBufferAllocators.preferredAllocator;
import static org.assertj.core.api.Assertions.assertThat;

class NettyOutboundTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package reactor.netty5;

import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.Buffer;
import io.netty5.channel.AbstractChannel;
import io.netty5.channel.Channel;
import io.netty5.channel.ChannelShutdownDirection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.util.function.Function;
import java.util.stream.Collectors;

import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.Buffer;
import io.netty5.util.Resource;
import io.netty5.channel.ChannelHandlerAdapter;
import io.netty5.channel.embedded.EmbeddedChannel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import java.util.function.Consumer;
import java.util.function.Supplier;

import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.Buffer;
import io.netty5.channel.ChannelOption;
import io.netty5.channel.EventLoopGroup;
import io.netty5.channel.MultithreadEventLoopGroup;
Expand Down Expand Up @@ -70,7 +70,7 @@
import reactor.util.Loggers;
import reactor.util.retry.Retry;

import static io.netty5.buffer.api.DefaultBufferAllocators.preferredAllocator;
import static io.netty5.buffer.DefaultBufferAllocators.preferredAllocator;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.Assumptions.assumeThat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import javax.net.ssl.SNIHostName;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.Buffer;
import io.netty5.channel.AdaptiveReadHandleFactory;
import io.netty5.channel.ChannelHandlerAdapter;
import io.netty5.channel.ChannelHandlerContext;
Expand Down Expand Up @@ -82,7 +82,7 @@
import reactor.util.Logger;
import reactor.util.Loggers;

import static io.netty5.buffer.api.DefaultBufferAllocators.preferredAllocator;
import static io.netty5.buffer.DefaultBufferAllocators.preferredAllocator;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
*/
package reactor.netty5.transport.logging;

import static io.netty5.buffer.api.DefaultBufferAllocators.preferredAllocator;
import static io.netty5.buffer.DefaultBufferAllocators.preferredAllocator;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

import java.nio.charset.Charset;

import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.Buffer;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.api.CompositeBuffer;
import io.netty5.buffer.Buffer;
import io.netty5.buffer.CompositeBuffer;
import io.netty5.channel.EventLoopGroup;
import io.netty5.channel.MultithreadEventLoopGroup;
import io.netty5.channel.nio.NioHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import io.micrometer.core.instrument.Timer;
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
import io.micrometer.core.tck.MeterRegistryAssert;
import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.Buffer;
import io.netty5.channel.socket.DatagramPacket;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package reactor.netty5.examples.documentation.http.client.http2;

import io.netty5.handler.codec.http.HttpHeaders;
import io.netty5.handler.codec.http.headers.HttpHeaders;
import reactor.core.publisher.Mono;
import reactor.netty5.http.HttpProtocol;
import reactor.netty5.http.client.HttpClient;
Expand All @@ -39,4 +39,4 @@ public static void main(String[] args) {
System.out.println("Used stream ID: " + response.getT2().get("x-http2-stream-id"));
System.out.println("Response: " + response.getT1());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package reactor.netty5.examples.documentation.http.client.http2;

import io.netty5.handler.codec.http.HttpHeaders;
import io.netty5.handler.codec.http.headers.HttpHeaders;
import reactor.core.publisher.Mono;
import reactor.netty5.http.HttpProtocol;
import reactor.netty5.http.client.HttpClient;
Expand All @@ -38,4 +38,4 @@ public static void main(String[] args) {
System.out.println("Used stream ID: " + response.getT2().get("x-http2-stream-id"));
System.out.println("Response: " + response.getT1());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ public class Application {
public static void main(String[] args) {
HttpClient client =
HttpClient.create()
.headers(h -> h.set(HttpHeaderNames.CONTENT_LENGTH, 5)); //<1>
.headers(h -> h.set(HttpHeaderNames.CONTENT_LENGTH, "5")); //<1>

client.post()
.uri("https://example.com/")
.send(BufferFlux.fromString(Mono.just("hello")))
.response()
.block();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public static void main(String[] args) {
DisposableServer server =
HttpServer.create()
.forwarded((connectionInfo, request) -> { // <1>
String hostHeader = request.headers().get("X-Forwarded-Host");
CharSequence hostHeader = request.headers().get("X-Forwarded-Host");
if (hostHeader != null) {
String[] hosts = hostHeader.split(",", 2);
String[] hosts = hostHeader.toString().split(",", 2);
InetSocketAddress hostAddress = AddressUtils.createUnresolved(
hosts[hosts.length - 1].trim(),
connectionInfo.getHostAddress().getPort());
Expand All @@ -48,4 +48,4 @@ public static void main(String[] args) {
server.onDispose()
.block();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
package reactor.netty5.examples.documentation.http.server.sse;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.api.BufferAllocator;
import io.netty5.buffer.Buffer;
import io.netty5.buffer.BufferAllocator;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
import reactor.netty5.DisposableServer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package reactor.netty5.examples.documentation.udp.server.send;

import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.Buffer;
import io.netty5.channel.socket.DatagramPacket;
import reactor.core.publisher.Mono;
import reactor.netty5.Connection;
Expand Down