diff --git a/feign-reactor-benchmarks/pom.xml b/feign-reactor-benchmarks/pom.xml index b4613ad43..15bc7e079 100644 --- a/feign-reactor-benchmarks/pom.xml +++ b/feign-reactor-benchmarks/pom.xml @@ -52,17 +52,17 @@ org.eclipse.jetty.http2 - http2-client + jetty-http2-client org.eclipse.jetty.http2 - http2-http-client-transport + jetty-http2-client-transport org.eclipse.jetty.http2 - http2-server + jetty-http2-server diff --git a/feign-reactor-benchmarks/src/main/java/reactivefeign/benchmarks/RealRequestBenchmarks.java b/feign-reactor-benchmarks/src/main/java/reactivefeign/benchmarks/RealRequestBenchmarks.java index f1b7b97ad..cc79b9494 100644 --- a/feign-reactor-benchmarks/src/main/java/reactivefeign/benchmarks/RealRequestBenchmarks.java +++ b/feign-reactor-benchmarks/src/main/java/reactivefeign/benchmarks/RealRequestBenchmarks.java @@ -10,14 +10,19 @@ import io.reactivex.netty.protocol.http.server.HttpServerRequest; import io.reactivex.netty.protocol.http.server.HttpServerResponse; import io.reactivex.netty.protocol.http.server.RequestHandler; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.http2.client.HTTP2Client; -import org.eclipse.jetty.http2.client.http.HttpClientTransportOverHTTP2; +import org.eclipse.jetty.http2.client.transport.HttpClientTransportOverHTTP2; import org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory; -import org.eclipse.jetty.server.*; -import org.eclipse.jetty.server.handler.AbstractHandler; +import org.eclipse.jetty.io.Content; +import org.eclipse.jetty.server.Handler; +import org.eclipse.jetty.server.HttpConfiguration; +import org.eclipse.jetty.server.HttpConnectionFactory; +import org.eclipse.jetty.server.Request; +import org.eclipse.jetty.server.Response; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; +import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.thread.QueuedThreadPool; import org.springframework.web.reactive.function.client.WebClient; import reactivefeign.java11.Java11ReactiveFeign; @@ -27,8 +32,8 @@ import reactivefeign.webclient.WebReactiveFeign; import reactor.core.publisher.Mono; -import java.io.IOException; import java.lang.reflect.ParameterizedType; +import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.HashMap; @@ -161,16 +166,17 @@ public rx.Observable handle(HttpServerRequest request, private Server jettyH2c(int port){ Server serverJetty = new Server(); - serverJetty.setHandler(new AbstractHandler(){ + serverJetty.setHandler(new Handler.Abstract(){ @Override - public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException { - request.getInputStream().skip(Integer.MAX_VALUE); - if(target.equals(PATH_WITH_PAYLOAD)){ - response.addHeader("Content-Type", "application/json"); - response.getOutputStream().write(responseJson); - response.getOutputStream().flush(); + public boolean handle(Request request, Response response, Callback callback) throws Exception { + Content.Chunk chunk = request.read(); + chunk.skip(Integer.MAX_VALUE); + if (request.getHttpURI().getPath().equals(PATH_WITH_PAYLOAD)) { + response.getHeaders().add("Content-Type", "application/json"); + response.write(true, ByteBuffer.wrap(responseJson), callback); } - baseRequest.setHandled(true); + callback.succeeded(); + return true; } }); diff --git a/feign-reactor-cloud/pom.xml b/feign-reactor-cloud/pom.xml index 895812858..92cb0391b 100644 --- a/feign-reactor-cloud/pom.xml +++ b/feign-reactor-cloud/pom.xml @@ -100,8 +100,8 @@ - com.github.tomakehurst - wiremock-jre8-standalone + org.wiremock + wiremock-standalone test diff --git a/feign-reactor-core/pom.xml b/feign-reactor-core/pom.xml index 8f4155836..c0998d3cb 100644 --- a/feign-reactor-core/pom.xml +++ b/feign-reactor-core/pom.xml @@ -83,8 +83,8 @@ - com.github.tomakehurst - wiremock-jre8-standalone + org.wiremock + wiremock-standalone test @@ -151,6 +151,7 @@ test + org.springframework.boot spring-boot-starter-test diff --git a/feign-reactor-core/src/main/java/reactivefeign/retry/BasicReactiveRetryPolicy.java b/feign-reactor-core/src/main/java/reactivefeign/retry/BasicReactiveRetryPolicy.java index c7b55b3c1..775db030e 100644 --- a/feign-reactor-core/src/main/java/reactivefeign/retry/BasicReactiveRetryPolicy.java +++ b/feign-reactor-core/src/main/java/reactivefeign/retry/BasicReactiveRetryPolicy.java @@ -57,12 +57,10 @@ public long retryDelay(Throwable error, int attemptNo) { if (attemptNo <= maxRetries) { if(periodInMs > 0) { long delay; - Date retryAfter; + Long retryAfter; // "Retry-After" header set - if (error instanceof RetryableException - && (retryAfter = ((RetryableException) error) - .retryAfter()) != null) { - delay = retryAfter.getTime() - clock.millis(); + if (error instanceof RetryableException re && (retryAfter = re.retryAfter()) != null) { + delay = retryAfter - clock.millis(); delay = Math.min(delay, periodInMs); delay = Math.max(delay, 0); } else { diff --git a/feign-reactor-core/src/test/java/reactivefeign/BaseReactorTest.java b/feign-reactor-core/src/test/java/reactivefeign/BaseReactorTest.java index e748199a3..2b0343010 100644 --- a/feign-reactor-core/src/test/java/reactivefeign/BaseReactorTest.java +++ b/feign-reactor-core/src/test/java/reactivefeign/BaseReactorTest.java @@ -49,7 +49,7 @@ public static void installBlockHound() { builder.allowBlockingCallsInside("org.eclipse.jetty.util.BlockingArrayQueue", "offer"); builder.allowBlockingCallsInside("org.eclipse.jetty.util.BlockingArrayQueue", "peek"); //java.net.InMemoryCookieStore.get - builder.allowBlockingCallsInside("org.eclipse.jetty.client.HttpConnection", "normalizeRequest"); + builder.allowBlockingCallsInside("org.eclipse.jetty.client.transport.HttpConnection", "normalizeRequest"); builder.allowBlockingCallsInside("java.util.concurrent.FutureTask", "handlePossibleCancellationInterrupt"); builder.allowBlockingCallsInside("org.eclipse.jetty.http2.HTTP2Session$StreamsState", "reserveSlot"); builder.allowBlockingCallsInside("org.eclipse.jetty.http2.HTTP2Session$StreamsState", "flush"); @@ -57,9 +57,11 @@ public static void installBlockHound() { //jetty http2 server builder.allowBlockingCallsInside("org.eclipse.jetty.util.IteratingCallback", "processing"); builder.allowBlockingCallsInside("org.eclipse.jetty.util.IteratingCallback", "iterate"); + builder.allowBlockingCallsInside("org.eclipse.jetty.util.thread.AutoLock", "lock"); //java11 builder.allowBlockingCallsInside("jdk.internal.net.http.MultiExchange", "responseAsync"); + builder.allowBlockingCallsInside("jdk.internal.misc.Unsafe", "park"); builder.allowBlockingCallsInside("com.sun.jmx.mbeanserver.Repository", "remove"); builder.allowBlockingCallsInside("com.sun.jmx.mbeanserver.Repository", "contains"); diff --git a/feign-reactor-core/src/test/java/reactivefeign/DefaultMethodHandlerTest.java b/feign-reactor-core/src/test/java/reactivefeign/DefaultMethodHandlerTest.java index 098948291..313c8cfaa 100644 --- a/feign-reactor-core/src/test/java/reactivefeign/DefaultMethodHandlerTest.java +++ b/feign-reactor-core/src/test/java/reactivefeign/DefaultMethodHandlerTest.java @@ -6,6 +6,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; public class DefaultMethodHandlerTest extends BaseReactorTest { @@ -37,6 +38,7 @@ public void shouldCallNotDefaultMethodOnActualImplementation() throws Throwable = new DefaultMethodHandler(TestInterface.class.getMethod("defaultMethod")); TestInterface mockImplementation = mock(TestInterface.class); + when(mockImplementation.defaultMethod()).thenCallRealMethod(); defaultMethodHandler.bindTo(mockImplementation); diff --git a/feign-reactor-core/src/test/java/reactivefeign/StatusHandlerTest.java b/feign-reactor-core/src/test/java/reactivefeign/StatusHandlerTest.java index 761918881..8f776d86b 100644 --- a/feign-reactor-core/src/test/java/reactivefeign/StatusHandlerTest.java +++ b/feign-reactor-core/src/test/java/reactivefeign/StatusHandlerTest.java @@ -139,7 +139,7 @@ public void shouldThrowOnStatusCode() { return new RetryableException( response.status(), "Should retry on next node", - httpMethod, null, request); + httpMethod, (Long) null, request); }), throwOnStatus( status -> status == SC_UNAUTHORIZED, diff --git a/feign-reactor-core/src/test/java/reactivefeign/allfeatures/AllFeaturesTest.java b/feign-reactor-core/src/test/java/reactivefeign/allfeatures/AllFeaturesTest.java index 67021ef0c..01dd58e79 100644 --- a/feign-reactor-core/src/test/java/reactivefeign/allfeatures/AllFeaturesTest.java +++ b/feign-reactor-core/src/test/java/reactivefeign/allfeatures/AllFeaturesTest.java @@ -42,7 +42,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.CountDownLatch; @@ -52,6 +51,8 @@ import static java.util.Arrays.asList; import static org.assertj.core.api.Assertions.assertThat; import static org.awaitility.Awaitility.waitAtMost; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import static reactivefeign.ReactivityTest.CALLS_NUMBER; import static reactivefeign.ReactivityTest.timeToCompleteReactively; import static reactivefeign.TestUtils.toLowerCaseKeys; @@ -99,16 +100,17 @@ public void setUp() { @Test public void shouldReturnAllPassedParameters() { - Map paramMap = new HashMap() {{ - put("paramKey1", "paramValue1"); - put("paramKey2", "paramValue2"); - }}; - Map returned = client.mirrorParameters(555,"777", paramMap) - .subscribeOn(testScheduler()).block(); + Map paramMap = Map.of("paramKey1", "paramValue1", "paramKey2", "paramValue2"); - assertThat(returned).containsEntry("paramInPath", "555"); - assertThat(returned).containsEntry("paramInUrl", "777"); - assertThat(returned).containsAllEntriesOf(paramMap); + Mono> result = client.mirrorParameters(555,"777", paramMap) + .subscribeOn(testScheduler()); + + StepVerifier.create(result) + .consumeNextWith(returned -> { + assertThat(returned).containsEntry("paramInPath", "555"); + assertThat(returned).containsEntry("paramInUrl", "777"); + assertThat(returned).containsAllEntriesOf(paramMap); + }); } @Test @@ -118,11 +120,15 @@ public void shouldReturnEmptyPassedParameters() { put("paramKey", ""); } }; - Map returned = client.mirrorParameters(555,"", paramMap) - .subscribeOn(testScheduler()).block(); + Mono> returned = client.mirrorParameters(555,"", paramMap) + .subscribeOn(testScheduler()); - assertThat(returned).containsEntry("paramKey", ""); - assertThat(returned).containsEntry("paramInUrl", ""); + StepVerifier.create(returned) + .consumeNextWith(map -> { + assertThat(map).containsEntry("paramKey", ""); + assertThat(map).containsEntry("paramInUrl", ""); + }) + .verifyComplete(); } @Test @@ -173,10 +179,12 @@ public void shouldNotReturnNullPassedParametersNew() { public void shouldReturnAllPassedListParametersNew() { List dynamicListParam = asList(1, 2, 3); - List returned = client.mirrorListParametersNew(dynamicListParam) - .subscribeOn(testScheduler()).block(); + Mono> result = client.mirrorListParametersNew(dynamicListParam) + .subscribeOn(testScheduler()); - assertThat(returned).containsAll(dynamicListParam); + StepVerifier.create(result) + .consumeNextWith(returned -> assertThat(returned).containsAll(dynamicListParam)) + .verifyComplete(); } @Test @@ -251,13 +259,17 @@ public void shouldReturnAllPassedListHeaders() { public void shouldReturnAllPassedMultiMapHeaders() { Map> headersMap = new HashMap>() { { - put("headerKey1", asList("headerValue1", "headerValue2")); + put("headerKey1", List.of("headerValue1, headerValue2")); } }; - Map> returned = client.mirrorMultiMapHeaders(headersMap) - .subscribeOn(testScheduler()).block(); + Mono>> result = client.mirrorMultiMapHeaders(headersMap) + .subscribeOn(testScheduler()); - assertThat(toLowerCaseKeys(returned)).containsAllEntriesOf(toLowerCaseKeys(headersMap)); + StepVerifier.create(result) + .consumeNextWith(returned -> { + assertNotNull(returned); + assertThat(toLowerCaseKeys(returned)).containsAllEntriesOf(toLowerCaseKeys(headersMap)); + }); } @Test @@ -337,14 +349,17 @@ public void shouldReturnFirstResultBeforeSecondSent() throws InterruptedExceptio countDownLatch.countDown(); }).subscribe(); - countDownLatch.await(); + boolean await = countDownLatch.await(5, TimeUnit.SECONDS); + assertThat(await).isTrue(); } @Test public void shouldReturnEmpty() { - Optional returned = client.empty() - .subscribeOn(testScheduler()).blockOptional(); - assertThat(!returned.isPresent()); + Mono returned = client.empty() + .subscribeOn(testScheduler()); + + StepVerifier.create(returned) + .verifyComplete(); } @Test @@ -354,7 +369,6 @@ public void shouldReturnDefaultBody() { assertThat(returned).isEqualTo("default"); } - @Test public void shouldRunReactively() { @@ -411,7 +425,6 @@ public void shouldMirrorBinaryBody() { @Test public void shouldMirrorStreamingBinaryBodyReactive() throws InterruptedException { - CountDownLatch countDownLatch = new CountDownLatch(2); AtomicInteger sentCount = new AtomicInteger(); @@ -420,7 +433,7 @@ public void shouldMirrorStreamingBinaryBodyReactive() throws InterruptedExceptio CompletableFuture firstReceived = new CompletableFuture<>(); Flux returned = client.mirrorStreamingBinaryBodyReactive( - Flux.just(fromByteArray(new byte[]{1,2,3}), fromByteArray(new byte[]{4,5,6}))) + Flux.just(fromByteArray(new byte[]{1,2,3}), fromByteArray(new byte[]{4,5,6}))) .subscribeOn(testScheduler()) .delayUntil(testObject -> sentCount.get() == 1 ? fromFuture(firstReceived) : empty()) @@ -430,12 +443,13 @@ public void shouldMirrorStreamingBinaryBodyReactive() throws InterruptedExceptio byte[] dataReceived = new byte[received.limit()]; received.get(dataReceived); receivedAll.add(dataReceived); - assertThat(receivedAll.size()).isEqualTo(sentCount.get()); + assertThat(receivedAll).hasSize(sentCount.get()); firstReceived.complete(received); countDownLatch.countDown(); }).subscribe(); - countDownLatch.await(); + boolean await = countDownLatch.await(5, TimeUnit.SECONDS); + assertTrue(await); assertThat(receivedAll).containsExactly(new byte[]{1,2,3}, new byte[]{4,5,6}); } @@ -480,7 +494,7 @@ public void shouldEncodePathParam() { @Test public void shouldEncodePathParamWithReservedChars() { - String PATH_PARAM = "workers?in=(\"123/321\")"; + String PATH_PARAM = "workers?in=(\"123321\")"; StepVerifier.create(client.encodePath(PATH_PARAM) .subscribeOn(testScheduler())) diff --git a/feign-reactor-core/src/test/java/reactivefeign/retry/BasicReactiveRetryPolicyTest.java b/feign-reactor-core/src/test/java/reactivefeign/retry/BasicReactiveRetryPolicyTest.java index 9c621f210..75f81f8a9 100644 --- a/feign-reactor-core/src/test/java/reactivefeign/retry/BasicReactiveRetryPolicyTest.java +++ b/feign-reactor-core/src/test/java/reactivefeign/retry/BasicReactiveRetryPolicyTest.java @@ -68,7 +68,7 @@ public void shouldTakeIntoAccountRetryAfter(){ assertThat(retryDelay).isEqualTo(delay); retryDelay = retryPolicy.retryDelay(new RetryableException(-1, "error msg", Request.HttpMethod.GET, - null, request), 1); + (Long) null, request), 1); assertThat(retryDelay).isEqualTo(backoff); } diff --git a/feign-reactor-java11/pom.xml b/feign-reactor-java11/pom.xml index 0b5cdfdb5..16af73eec 100644 --- a/feign-reactor-java11/pom.xml +++ b/feign-reactor-java11/pom.xml @@ -59,8 +59,8 @@ - com.github.tomakehurst - wiremock-jre8-standalone + org.wiremock + wiremock-standalone test @@ -71,21 +71,20 @@ - org.eclipse.jetty - jetty-servlet + org.eclipse.jetty.ee10 + jetty-ee10-servlet test org.eclipse.jetty.http2 - http2-server + jetty-http2-server test - org.eclipse.jetty - jetty-webapp - test + org.eclipse.jetty.ee10 + jetty-ee10-webapp diff --git a/feign-reactor-jetty/pom.xml b/feign-reactor-jetty/pom.xml index d243e78f3..17f461103 100644 --- a/feign-reactor-jetty/pom.xml +++ b/feign-reactor-jetty/pom.xml @@ -17,15 +17,20 @@ feign-reactor-core + + org.eclipse.jetty + jetty-client + + org.eclipse.jetty.http2 - http2-client + jetty-http2-client true org.eclipse.jetty.http2 - http2-http-client-transport + jetty-http2-client-transport true @@ -72,8 +77,8 @@ - com.github.tomakehurst - wiremock-jre8-standalone + org.wiremock + wiremock-standalone test @@ -84,20 +89,20 @@ - org.eclipse.jetty - jetty-servlet + org.eclipse.jetty.ee10 + jetty-ee10-servlets test org.eclipse.jetty.http2 - http2-server + jetty-http2-server test - org.eclipse.jetty - jetty-webapp + org.eclipse.jetty.ee10 + jetty-ee10-webapp test diff --git a/feign-reactor-jetty/src/main/java/reactivefeign/jetty/JettyReactiveFeign.java b/feign-reactor-jetty/src/main/java/reactivefeign/jetty/JettyReactiveFeign.java index 6fb234941..d3d3c327e 100644 --- a/feign-reactor-jetty/src/main/java/reactivefeign/jetty/JettyReactiveFeign.java +++ b/feign-reactor-jetty/src/main/java/reactivefeign/jetty/JettyReactiveFeign.java @@ -18,7 +18,7 @@ import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.HttpProxy; import org.eclipse.jetty.http2.client.HTTP2Client; -import org.eclipse.jetty.http2.client.http.HttpClientTransportOverHTTP2; +import org.eclipse.jetty.http2.client.transport.HttpClientTransportOverHTTP2; import reactivefeign.ReactiveFeign; import reactivefeign.ReactiveFeignBuilder; import reactivefeign.ReactiveOptions; @@ -113,8 +113,8 @@ protected ReactiveHttpClientFactory clientFactory() { if(options != null && this.options.getProxySettings() != null){ ReactiveOptions.ProxySettings proxySettings = this.options.getProxySettings(); - httpClient.getProxyConfiguration().getProxies() - .add(new HttpProxy(proxySettings.getHost(), proxySettings.getPort())); + httpClient.getProxyConfiguration() + .addProxy(new HttpProxy(proxySettings.getHost(), proxySettings.getPort())); } return methodMetadata -> { diff --git a/feign-reactor-jetty/src/main/java/reactivefeign/jetty/client/JettyReactiveHttpClient.java b/feign-reactor-jetty/src/main/java/reactivefeign/jetty/client/JettyReactiveHttpClient.java index 4084623ad..9a7bb22e5 100644 --- a/feign-reactor-jetty/src/main/java/reactivefeign/jetty/client/JettyReactiveHttpClient.java +++ b/feign-reactor-jetty/src/main/java/reactivefeign/jetty/client/JettyReactiveHttpClient.java @@ -23,16 +23,21 @@ import com.fasterxml.jackson.databind.ObjectWriter; import feign.MethodMetadata; import org.eclipse.jetty.client.HttpClient; -import org.eclipse.jetty.client.api.Request; +import org.eclipse.jetty.client.Request; import org.eclipse.jetty.http.HttpFields; -import org.eclipse.jetty.reactive.client.ContentChunk; +import org.eclipse.jetty.io.Content; import org.eclipse.jetty.reactive.client.ReactiveRequest; import org.reactivestreams.Publisher; -import reactivefeign.client.*; +import reactivefeign.client.ReactiveFeignException; +import reactivefeign.client.ReactiveHttpClient; +import reactivefeign.client.ReactiveHttpRequest; +import reactivefeign.client.ReactiveHttpResponse; +import reactivefeign.client.ReadTimeoutException; import reactivefeign.utils.SerializedFormData; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import java.io.IOException; import java.io.UncheckedIOException; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; @@ -44,191 +49,197 @@ import static java.util.Collections.singletonList; import static org.eclipse.jetty.http.HttpHeader.ACCEPT; import static org.eclipse.jetty.http.HttpHeader.ACCEPT_ENCODING; -import static reactivefeign.jetty.utils.ProxyPostProcessor.postProcess; -import static reactivefeign.utils.FeignUtils.*; -import static reactivefeign.utils.HttpUtils.*; +import static reactivefeign.utils.FeignUtils.getBodyActualType; +import static reactivefeign.utils.FeignUtils.returnActualType; +import static reactivefeign.utils.FeignUtils.returnPublisherType; +import static reactivefeign.utils.HttpUtils.APPLICATION_JSON; +import static reactivefeign.utils.HttpUtils.APPLICATION_JSON_UTF_8; +import static reactivefeign.utils.HttpUtils.APPLICATION_OCTET_STREAM; +import static reactivefeign.utils.HttpUtils.APPLICATION_STREAM_JSON; +import static reactivefeign.utils.HttpUtils.APPLICATION_STREAM_JSON_UTF_8; +import static reactivefeign.utils.HttpUtils.FORM_URL_ENCODED; +import static reactivefeign.utils.HttpUtils.GZIP; +import static reactivefeign.utils.HttpUtils.NEWLINE_SEPARATOR; +import static reactivefeign.utils.HttpUtils.TEXT; +import static reactivefeign.utils.HttpUtils.TEXT_UTF_8; /** * Uses reactive Jetty client to execute http requests + * * @author Sergii Karpenko */ public class JettyReactiveHttpClient implements ReactiveHttpClient { - private final HttpClient httpClient; - private final Class bodyActualClass; - private final Class returnPublisherClass; - private final Class returnActualClass; - private final JsonFactory jsonFactory; - private final ObjectWriter bodyWriter; - private final ObjectReader responseReader; - private long requestTimeout = -1; - private boolean tryUseCompression; - - public static JettyReactiveHttpClient jettyClient( - MethodMetadata methodMetadata, - HttpClient httpClient, - JsonFactory jsonFactory, ObjectMapper objectMapper) { - - Class returnPublisherType = returnPublisherType(methodMetadata); - Type returnActualType = returnActualType(methodMetadata); - Type bodyActualType = getBodyActualType(methodMetadata.bodyType()); - ObjectWriter bodyWriter = bodyActualType != null - ? objectMapper.writerFor(objectMapper.constructType(bodyActualType)) : null; - ObjectReader responseReader = objectMapper.readerFor(objectMapper.constructType(returnActualType)); - - return new JettyReactiveHttpClient(httpClient, - getClass(bodyActualType), returnPublisherType, getClass(returnActualType), - jsonFactory, bodyWriter, responseReader); - } - - public JettyReactiveHttpClient(HttpClient httpClient, - Class bodyActualClass, Class returnPublisherClass, Class returnActualClass, - JsonFactory jsonFactory, ObjectWriter bodyWriter, ObjectReader responseReader) { - this.httpClient = httpClient; - this.bodyActualClass = bodyActualClass; - this.returnPublisherClass = returnPublisherClass; - this.returnActualClass = returnActualClass; - this.jsonFactory = jsonFactory; - this.bodyWriter = bodyWriter; - this.responseReader = responseReader; - } - - public JettyReactiveHttpClient setRequestTimeout(long timeoutInMillis){ - this.requestTimeout = timeoutInMillis; - return this; - } - - public JettyReactiveHttpClient setTryUseCompression(boolean tryUseCompression){ - this.tryUseCompression = tryUseCompression; - return this; - } - - @Override - public Mono executeRequest(ReactiveHttpRequest request) { - Request jettyRequest = httpClient - .newRequest(request.uri()) - .headers(httpFields -> setUpHeaders(request, httpFields)) - .method(request.method()); - - if(requestTimeout > 0){ - jettyRequest.timeout(requestTimeout, TimeUnit.MILLISECONDS); - } - - ReactiveRequest.Builder requestBuilder = ReactiveRequest.newBuilder(jettyRequest); - if(bodyActualClass != null - || request.body() instanceof SerializedFormData){ - requestBuilder.content(provideBody(request)); - } - - return Mono.from(requestBuilder.build().response((response, content) -> Mono.just( - new JettyReactiveHttpResponse(request, response.getResponse(), - postProcess(content, - (contentChunk, throwable) -> { - if(throwable != null){ - contentChunk.callback.failed(throwable); - } else { - contentChunk.callback.succeeded(); - } - }), - returnPublisherClass, returnActualClass, - jsonFactory, responseReader)))) - .onErrorMap(ex -> { - if(ex instanceof java.util.concurrent.TimeoutException){ - return new ReadTimeoutException(ex, request); - } else { - return new ReactiveFeignException(ex, request); - } - }); - } - - protected void setUpHeaders(ReactiveHttpRequest request, HttpFields.Mutable httpHeaders) { - request.headers().forEach(httpHeaders::put); - - String acceptHeader; - if(CharSequence.class.isAssignableFrom(returnActualClass) && returnPublisherClass == Mono.class){ - acceptHeader = TEXT; - } - else if(returnActualClass == ByteBuffer.class || returnActualClass == byte[].class){ - acceptHeader = APPLICATION_OCTET_STREAM; - } - else if(returnPublisherClass == Mono.class){ - acceptHeader = APPLICATION_JSON; - } - else { - acceptHeader = APPLICATION_STREAM_JSON; - } - httpHeaders.put(ACCEPT.asString(), singletonList(acceptHeader)); - - if(tryUseCompression){ - httpHeaders.put(ACCEPT_ENCODING.asString(), singletonList(GZIP)); - } else { - httpHeaders.remove(ACCEPT_ENCODING.asString()); - } - } - - protected ReactiveRequest.Content provideBody(ReactiveHttpRequest request) { - Publisher bodyPublisher; - String contentType; - if(request.body() instanceof SerializedFormData){ - bodyPublisher = Mono.just(toByteBufferChunk(((SerializedFormData)request.body()).getFormData())); - contentType = FORM_URL_ENCODED; - } - else if(request.body() instanceof Mono){ - if(bodyActualClass == ByteBuffer.class){ - bodyPublisher = ((Mono)request.body()).map(this::toByteBufferChunk); - contentType = APPLICATION_OCTET_STREAM; - } - else if (CharSequence.class.isAssignableFrom(bodyActualClass)){ - bodyPublisher = Flux.from(request.body()).map(this::toCharSequenceChunk); - contentType = TEXT_UTF_8; - } - else { - bodyPublisher = Flux.from(request.body()).map(data -> toJsonChunk(data, false)); - contentType = APPLICATION_JSON_UTF_8; - } - - } else { - if(bodyActualClass == ByteBuffer.class){ - bodyPublisher = Flux.from(request.body()).map(this::toByteBufferChunk); - contentType = APPLICATION_OCTET_STREAM; - } - else { - bodyPublisher = Flux.from(request.body()).map(data -> toJsonChunk(data, true)); - contentType = APPLICATION_STREAM_JSON_UTF_8; - } - } - //TODO - //String originalContentType = request.headers().get(CONTENT_TYPE_HEADER).get(0); - - return ReactiveRequest.Content.fromPublisher(bodyPublisher, contentType); - } - - protected ContentChunk toByteBufferChunk(Object data){ - return new ContentChunk((ByteBuffer)data); - } - - protected ContentChunk toCharSequenceChunk(Object data){ - CharBuffer charBuffer = CharBuffer.wrap((CharSequence) data); - ByteBuffer byteBuffer = UTF_8.encode(charBuffer); - return new ContentChunk(byteBuffer); - } - - protected ContentChunk toJsonChunk(Object data, boolean stream){ - try { - ByteArrayBuilder byteArrayBuilder = new ByteArrayBuilder(); - bodyWriter.writeValue(byteArrayBuilder, data); - if(stream) { - byteArrayBuilder.write(NEWLINE_SEPARATOR); - } - ByteBuffer buffer = ByteBuffer.wrap(byteArrayBuilder.toByteArray()); - return new ContentChunk(buffer); - } catch (java.io.IOException e) { - throw new UncheckedIOException(e); - } - } - - public static Class getClass(Type type){ - return (Class)(type instanceof ParameterizedType - ? ((ParameterizedType) type).getRawType() : type); - } + private final HttpClient httpClient; + private final Class bodyActualClass; + private final Class returnPublisherClass; + private final Class returnActualClass; + private final JsonFactory jsonFactory; + private final ObjectWriter bodyWriter; + private final ObjectReader responseReader; + private long requestTimeout = -1; + private boolean tryUseCompression; + + public static JettyReactiveHttpClient jettyClient( + MethodMetadata methodMetadata, + HttpClient httpClient, + JsonFactory jsonFactory, ObjectMapper objectMapper) { + + Class returnPublisherType = returnPublisherType(methodMetadata); + Type returnActualType = returnActualType(methodMetadata); + Type bodyActualType = getBodyActualType(methodMetadata.bodyType()); + ObjectWriter bodyWriter = bodyActualType != null + ? objectMapper.writerFor(objectMapper.constructType(bodyActualType)) : null; + ObjectReader responseReader = objectMapper.readerFor(objectMapper.constructType(returnActualType)); + + return new JettyReactiveHttpClient(httpClient, + getClass(bodyActualType), returnPublisherType, getClass(returnActualType), + jsonFactory, bodyWriter, responseReader); + } + + public JettyReactiveHttpClient(HttpClient httpClient, + Class bodyActualClass, Class returnPublisherClass, Class returnActualClass, + JsonFactory jsonFactory, ObjectWriter bodyWriter, ObjectReader responseReader) { + this.httpClient = httpClient; + this.bodyActualClass = bodyActualClass; + this.returnPublisherClass = returnPublisherClass; + this.returnActualClass = returnActualClass; + this.jsonFactory = jsonFactory; + this.bodyWriter = bodyWriter; + this.responseReader = responseReader; + } + + public JettyReactiveHttpClient setRequestTimeout(long timeoutInMillis) { + this.requestTimeout = timeoutInMillis; + return this; + } + + public JettyReactiveHttpClient setTryUseCompression(boolean tryUseCompression) { + this.tryUseCompression = tryUseCompression; + return this; + } + + @Override + public Mono executeRequest(ReactiveHttpRequest request) { + Request jettyRequest = httpClient + .newRequest(request.uri()) + .headers(httpFields -> setUpHeaders(request, httpFields)) + .method(request.method()); + + if (requestTimeout > 0) { + jettyRequest.timeout(requestTimeout, TimeUnit.MILLISECONDS); + } + + ReactiveRequest.Builder requestBuilder = ReactiveRequest.newBuilder(jettyRequest); + if (bodyActualClass != null + || request.body() instanceof SerializedFormData) { + requestBuilder.content(provideBody(request)); + } + + return Mono.from(requestBuilder.build().response((response, content) -> Mono.just( + new JettyReactiveHttpResponse( + request, + response.getResponse(), + content, + returnPublisherClass, + returnActualClass, + jsonFactory, + responseReader) + ))) + .onErrorMap(ex -> { + if (ex instanceof java.util.concurrent.TimeoutException) { + return new ReadTimeoutException(ex, request); + } else { + return new ReactiveFeignException(ex, request); + } + }); + } + + protected void setUpHeaders(ReactiveHttpRequest request, HttpFields.Mutable httpHeaders) { + request.headers().forEach(httpHeaders::put); + + String acceptHeader; + if (CharSequence.class.isAssignableFrom(returnActualClass) && returnPublisherClass == Mono.class) { + acceptHeader = TEXT; + } else if (returnActualClass == ByteBuffer.class || returnActualClass == byte[].class) { + acceptHeader = APPLICATION_OCTET_STREAM; + } else if (returnPublisherClass == Mono.class) { + acceptHeader = APPLICATION_JSON; + } else { + acceptHeader = APPLICATION_STREAM_JSON; + } + httpHeaders.put(ACCEPT.asString(), singletonList(acceptHeader)); + + if (tryUseCompression) { + httpHeaders.put(ACCEPT_ENCODING.asString(), singletonList(GZIP)); + } else { + httpHeaders.remove(ACCEPT_ENCODING.asString()); + } + } + + protected ReactiveRequest.Content provideBody(ReactiveHttpRequest request) { + Publisher bodyPublisher; + String contentType; + if (request.body() instanceof SerializedFormData) { + bodyPublisher = Mono.just(toByteBufferChunk(((SerializedFormData) request.body()).getFormData(), false)); + contentType = FORM_URL_ENCODED; + } else if (request.body() instanceof Mono) { + if (bodyActualClass == ByteBuffer.class) { + bodyPublisher = ((Mono) request.body()).map(data -> toByteBufferChunk(data, false)); + contentType = APPLICATION_OCTET_STREAM; + } else if (CharSequence.class.isAssignableFrom(bodyActualClass)) { + bodyPublisher = Flux.from(request.body()).map(data -> toCharSequenceChunk(data, false)); + contentType = TEXT_UTF_8; + } else { + bodyPublisher = Flux.from(request.body()).map(data -> toJsonChunk(data, false)); + contentType = APPLICATION_JSON_UTF_8; + } + } else { + if (bodyActualClass == ByteBuffer.class) { + bodyPublisher = Flux.concat( + Flux.from(request.body()).map(data -> toByteBufferChunk(data, true)), + Flux.just(Content.Chunk.EOF) + ); + contentType = APPLICATION_OCTET_STREAM; + } else { + bodyPublisher = Flux.concat( + Flux.from(request.body()).map(data -> toJsonChunk(data, true)), + Flux.just(Content.Chunk.EOF) + ); + contentType = APPLICATION_STREAM_JSON_UTF_8; + } + } + //TODO + //String originalContentType = request.headers().get(CONTENT_TYPE_HEADER).get(0); + + return ReactiveRequest.Content.fromPublisher(bodyPublisher, contentType); + } + + protected Content.Chunk toByteBufferChunk(Object data, boolean stream) { + return Content.Chunk.from((ByteBuffer) data, !stream); + } + + protected Content.Chunk toCharSequenceChunk(Object data, boolean stream) { + CharBuffer charBuffer = CharBuffer.wrap((CharSequence) data); + ByteBuffer byteBuffer = UTF_8.encode(charBuffer); + return Content.Chunk.from(byteBuffer, !stream); + } + + protected Content.Chunk toJsonChunk(Object data, boolean stream) { + try { + ByteArrayBuilder byteArrayBuilder = new ByteArrayBuilder(); + bodyWriter.writeValue(byteArrayBuilder, data); + if (stream) { + byteArrayBuilder.write(NEWLINE_SEPARATOR); + } + ByteBuffer buffer = ByteBuffer.wrap(byteArrayBuilder.toByteArray()); + return Content.Chunk.from(buffer, !stream); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + public static Class getClass(Type type) { + return (Class) (type instanceof ParameterizedType pt ? pt.getRawType() : type); + } } diff --git a/feign-reactor-jetty/src/main/java/reactivefeign/jetty/client/JettyReactiveHttpResponse.java b/feign-reactor-jetty/src/main/java/reactivefeign/jetty/client/JettyReactiveHttpResponse.java index d02854ce7..0e976cd57 100644 --- a/feign-reactor-jetty/src/main/java/reactivefeign/jetty/client/JettyReactiveHttpResponse.java +++ b/feign-reactor-jetty/src/main/java/reactivefeign/jetty/client/JettyReactiveHttpResponse.java @@ -2,9 +2,10 @@ import com.fasterxml.jackson.core.async_.JsonFactory; import com.fasterxml.jackson.databind.ObjectReader; -import org.eclipse.jetty.client.api.Response; +import org.eclipse.jetty.client.Response; import org.eclipse.jetty.http.HttpFields; -import org.eclipse.jetty.reactive.client.ContentChunk; +import org.eclipse.jetty.io.Content; +import org.eclipse.jetty.io.Retainable; import org.reactivestreams.Publisher; import reactivefeign.client.ReactiveHttpRequest; import reactivefeign.client.ReactiveHttpResponse; @@ -30,13 +31,13 @@ class JettyReactiveHttpResponse implements ReactiveHttpResponse{ public static final String CHARSET_DELIMITER = ";charset="; private ReactiveHttpRequest request; private final Response clientResponse; - private final Publisher contentChunks; + private final Publisher contentChunks; private final Class returnPublisherType; private Class returnActualClass; private final ObjectReader objectReader; private final JsonFactory jsonFactory; - JettyReactiveHttpResponse(ReactiveHttpRequest request, Response clientResponse, Publisher contentChunks, + JettyReactiveHttpResponse(ReactiveHttpRequest request, Response clientResponse, Publisher contentChunks, Class returnPublisherType, Class returnActualClass, JsonFactory jsonFactory, ObjectReader objectReader) { this.request = request; @@ -102,7 +103,9 @@ public Publisher body() { @Override public Mono releaseBody() { - return Flux.from(contentChunks).then(); + return Flux.from(contentChunks) + .doOnNext(Retainable::release) + .then(); } private Charset getCharset() { @@ -120,7 +123,8 @@ private Charset getCharset() { } private Flux directContent() { - return Flux.from(contentChunks).map(contentChunk -> contentChunk.buffer.slice()); + return Flux.from(contentChunks) + .map(contentChunk -> contentChunk.getByteBuffer().slice()); } @Override diff --git a/feign-reactor-jetty/src/test/java/reactivefeign/jetty/h2c/AllFeaturesTest.java b/feign-reactor-jetty/src/test/java/reactivefeign/jetty/h2c/AllFeaturesTest.java index 6d1259c0c..79bb9a8fd 100644 --- a/feign-reactor-jetty/src/test/java/reactivefeign/jetty/h2c/AllFeaturesTest.java +++ b/feign-reactor-jetty/src/test/java/reactivefeign/jetty/h2c/AllFeaturesTest.java @@ -40,7 +40,7 @@ */ @EnableAutoConfiguration(exclude = {ReactiveSecurityAutoConfiguration.class, ReactiveUserDetailsServiceAutoConfiguration.class}) @ContextConfiguration(classes={TestServerConfigurations.class}) -@ActiveProfiles(JETTY_H2C) +@ActiveProfiles(UNDERTOW_H2C) public class AllFeaturesTest extends AllFeaturesFeignTest { @Override diff --git a/feign-reactor-parent/pom.xml b/feign-reactor-parent/pom.xml index 53500c58a..76fe422d4 100644 --- a/feign-reactor-parent/pom.xml +++ b/feign-reactor-parent/pom.xml @@ -18,8 +18,8 @@ UTF-8 - 2022.0.4 - 3.0.1 + 2023.0.2 + 3.2.7 0.0.4 @@ -28,19 +28,18 @@ 4.13.2 - 2.35.0 + 3.5.4 4.2.0 - 1.0.8.RELEASE + 1.0.9.RELEASE 3.4.4 - 3.1.7 5.16.0 0.8.11 4.3.0 - 3.11.0 - 3.2.1 + 3.13.0 + 3.2.5 3.5.0 3.3.0 @@ -176,8 +175,8 @@ - com.github.tomakehurst - wiremock-jre8-standalone + org.wiremock + wiremock-standalone ${wiremock.version} test diff --git a/feign-reactor-rx2/pom.xml b/feign-reactor-rx2/pom.xml index ec5a7eda8..76ebc39fa 100644 --- a/feign-reactor-rx2/pom.xml +++ b/feign-reactor-rx2/pom.xml @@ -37,6 +37,7 @@ org.springframework.boot + test @@ -74,8 +75,8 @@ - com.github.tomakehurst - wiremock-jre8-standalone + org.wiremock + wiremock-standalone test diff --git a/feign-reactor-rx2/src/test/java/reactivefeign/rx2/StatusHandlerTest.java b/feign-reactor-rx2/src/test/java/reactivefeign/rx2/StatusHandlerTest.java index ec8f88148..62d3cb6b0 100644 --- a/feign-reactor-rx2/src/test/java/reactivefeign/rx2/StatusHandlerTest.java +++ b/feign-reactor-rx2/src/test/java/reactivefeign/rx2/StatusHandlerTest.java @@ -65,7 +65,7 @@ public void shouldThrowRetryException() throws InterruptedException { return new RetryableException( response.status(), "Should retry on next node", - httpMethod, null, request); + httpMethod, (Long) null, request); })) .target(IcecreamServiceApi.class, "http://localhost:" + wireMockRule.port()); diff --git a/feign-reactor-spring-configuration/src/main/java/reactivefeign/spring/config/ReactiveFeignClientsRegistrar.java b/feign-reactor-spring-configuration/src/main/java/reactivefeign/spring/config/ReactiveFeignClientsRegistrar.java index 729eb5df8..94ccb8196 100644 --- a/feign-reactor-spring-configuration/src/main/java/reactivefeign/spring/config/ReactiveFeignClientsRegistrar.java +++ b/feign-reactor-spring-configuration/src/main/java/reactivefeign/spring/config/ReactiveFeignClientsRegistrar.java @@ -178,7 +178,8 @@ private void registerReactiveFeignClient(BeanDefinitionRegistry registry, String alias = name + "ReactiveFeignClient"; AbstractBeanDefinition beanDefinition = definition.getBeanDefinition(); - beanDefinition.setAttribute(FactoryBean.OBJECT_TYPE_ATTRIBUTE, className); + Class type = ClassUtils.resolveClassName(className, null); + beanDefinition.setAttribute(FactoryBean.OBJECT_TYPE_ATTRIBUTE, type); boolean primary = (Boolean)attributes.get("primary"); // has a default, won't be null diff --git a/feign-reactor-test/feign-reactor-server-configurations/pom.xml b/feign-reactor-test/feign-reactor-server-configurations/pom.xml index de382b325..4313e23e3 100644 --- a/feign-reactor-test/feign-reactor-server-configurations/pom.xml +++ b/feign-reactor-test/feign-reactor-server-configurations/pom.xml @@ -41,7 +41,7 @@ org.eclipse.jetty.http2 - http2-server + jetty-http2-server test @@ -52,8 +52,8 @@ - com.github.tomakehurst - wiremock-jre8-standalone + org.wiremock + wiremock-standalone test diff --git a/feign-reactor-test/feign-reactor-server-configurations/src/test/java/reactivefeign/spring/server/config/TestServerConfigurations.java b/feign-reactor-test/feign-reactor-server-configurations/src/test/java/reactivefeign/spring/server/config/TestServerConfigurations.java index 8a5699bdb..e2111ce2d 100644 --- a/feign-reactor-test/feign-reactor-server-configurations/src/test/java/reactivefeign/spring/server/config/TestServerConfigurations.java +++ b/feign-reactor-test/feign-reactor-server-configurations/src/test/java/reactivefeign/spring/server/config/TestServerConfigurations.java @@ -12,6 +12,8 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; +import java.util.Arrays; + import static java.util.Collections.singleton; @Configuration @@ -30,14 +32,20 @@ public ReactiveWebServerFactory reactiveWebServerFactory(){ Http2 http2 = new Http2(); http2.setEnabled(true); jettyReactiveWebServerFactory.setHttp2(http2); - jettyReactiveWebServerFactory.setServerCustomizers(singleton(server -> { - ServerConnector sc = (ServerConnector) server.getConnectors()[0]; + jettyReactiveWebServerFactory.addServerCustomizers(server -> { HttpConfiguration httpConfig = new HttpConfiguration(); httpConfig.setIdleTimeout(0); - HTTP2CServerConnectionFactory http2CFactory = new HTTP2CServerConnectionFactory(httpConfig); + HTTP2CServerConnectionFactory http2CFactory = new HTTP2CServerConnectionFactory(httpConfig, "h2c"); http2CFactory.setMaxConcurrentStreams(1000); - sc.addConnectionFactory(http2CFactory); - })); + Arrays.stream(server.getConnectors()) + .filter(ServerConnector.class::isInstance) + .map(ServerConnector.class::cast) + .findFirst() + .ifPresentOrElse(sc -> sc.addConnectionFactory(http2CFactory), () -> { + ServerConnector sc = new ServerConnector(server, http2CFactory); + server.addConnector(sc); + }); + }); return jettyReactiveWebServerFactory; } } diff --git a/feign-reactor-test/feign-reactor-server-configurations/src/test/java/reactivefeign/wiremock/WireMockServerConfigurations.java b/feign-reactor-test/feign-reactor-server-configurations/src/test/java/reactivefeign/wiremock/WireMockServerConfigurations.java index 3ecd3218d..1cea75b80 100644 --- a/feign-reactor-test/feign-reactor-server-configurations/src/test/java/reactivefeign/wiremock/WireMockServerConfigurations.java +++ b/feign-reactor-test/feign-reactor-server-configurations/src/test/java/reactivefeign/wiremock/WireMockServerConfigurations.java @@ -2,7 +2,7 @@ import com.github.tomakehurst.wiremock.common.JettySettings; import com.github.tomakehurst.wiremock.core.WireMockConfiguration; -import com.github.tomakehurst.wiremock.jetty9.JettyHttpServer; +import com.github.tomakehurst.wiremock.jetty11.Jetty11HttpServer; import wiremock.org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory; import wiremock.org.eclipse.jetty.io.NetworkTrafficListener; import wiremock.org.eclipse.jetty.server.ConnectionFactory; @@ -10,6 +10,9 @@ import wiremock.org.eclipse.jetty.server.HttpConnectionFactory; import wiremock.org.eclipse.jetty.server.ServerConnector; +import static com.github.tomakehurst.wiremock.jetty11.Jetty11Utils.createHttpConfig; +import static com.github.tomakehurst.wiremock.jetty11.Jetty11Utils.createServerConnector; + public class WireMockServerConfigurations { public static WireMockConfiguration h2cConfig(){ @@ -21,7 +24,7 @@ public static WireMockConfiguration h2cConfig(boolean includeH1, int maxConcurre .dynamicPort() .asynchronousResponseEnabled(true) .httpServerFactory((options, adminRequestHandler, stubRequestHandler) -> - new JettyHttpServer(options, adminRequestHandler, stubRequestHandler) { + new Jetty11HttpServer(options, adminRequestHandler, stubRequestHandler) { @Override protected ServerConnector createHttpConnector( String bindAddress, int port, JettySettings jettySettings, NetworkTrafficListener listener) { @@ -32,6 +35,7 @@ protected ServerConnector createHttpConnector( http2CFactory.setMaxConcurrentStreams(maxConcurrentCalls); return createServerConnector( + jettyServer, bindAddress, jettySettings, port, diff --git a/feign-reactor-test/feign-reactor-spring-configuration-cloud2-test/pom.xml b/feign-reactor-test/feign-reactor-spring-configuration-cloud2-test/pom.xml index 07a906cff..aa3f48cd9 100644 --- a/feign-reactor-test/feign-reactor-spring-configuration-cloud2-test/pom.xml +++ b/feign-reactor-test/feign-reactor-spring-configuration-cloud2-test/pom.xml @@ -105,8 +105,8 @@ test - com.github.tomakehurst - wiremock-jre8-standalone + org.wiremock + wiremock-standalone test diff --git a/feign-reactor-test/feign-reactor-spring-configuration-test/pom.xml b/feign-reactor-test/feign-reactor-spring-configuration-test/pom.xml index 81f646670..7e4aede9d 100644 --- a/feign-reactor-test/feign-reactor-spring-configuration-test/pom.xml +++ b/feign-reactor-test/feign-reactor-spring-configuration-test/pom.xml @@ -83,8 +83,8 @@ test - com.github.tomakehurst - wiremock-jre8-standalone + org.wiremock + wiremock-standalone test diff --git a/feign-reactor-test/feign-reactor-spring-mvc-test/pom.xml b/feign-reactor-test/feign-reactor-spring-mvc-test/pom.xml index af8d6ee8a..495169240 100644 --- a/feign-reactor-test/feign-reactor-spring-mvc-test/pom.xml +++ b/feign-reactor-test/feign-reactor-spring-mvc-test/pom.xml @@ -111,8 +111,8 @@ test - com.github.tomakehurst - wiremock-jre8-standalone + org.wiremock + wiremock-standalone test diff --git a/feign-reactor-webclient-apache-client5/pom.xml b/feign-reactor-webclient-apache-client5/pom.xml index aa5428537..9b0f6dade 100644 --- a/feign-reactor-webclient-apache-client5/pom.xml +++ b/feign-reactor-webclient-apache-client5/pom.xml @@ -98,8 +98,8 @@ test - com.github.tomakehurst - wiremock-jre8-standalone + org.wiremock + wiremock-standalone test @@ -110,20 +110,20 @@ - org.eclipse.jetty - jetty-servlet + org.eclipse.jetty.ee10 + jetty-ee10-servlets test org.eclipse.jetty.http2 - http2-server + jetty-http2-server test - org.eclipse.jetty - jetty-webapp + org.eclipse.jetty.ee10 + jetty-ee10-webapp test diff --git a/feign-reactor-webclient-core/pom.xml b/feign-reactor-webclient-core/pom.xml index 02b7c978f..53ed9c293 100644 --- a/feign-reactor-webclient-core/pom.xml +++ b/feign-reactor-webclient-core/pom.xml @@ -46,8 +46,8 @@ - com.github.tomakehurst - wiremock-jre8-standalone + org.wiremock + wiremock-standalone test diff --git a/feign-reactor-webclient-jetty/pom.xml b/feign-reactor-webclient-jetty/pom.xml index 4046f3597..e3601d3d0 100644 --- a/feign-reactor-webclient-jetty/pom.xml +++ b/feign-reactor-webclient-jetty/pom.xml @@ -36,16 +36,21 @@ org.eclipse.jetty.http2 - http2-client + jetty-http2-client true org.eclipse.jetty.http2 - http2-http-client-transport + jetty-http2-client-transport true + + org.eclipse.jetty + jetty-client + + com.playtika.reactivefeign @@ -92,8 +97,8 @@ test - com.github.tomakehurst - wiremock-jre8-standalone + org.wiremock + wiremock-standalone test diff --git a/feign-reactor-webclient-jetty/src/main/java/reactivefeign/webclient/jetty/JettyClientHttpConnectorBuilder.java b/feign-reactor-webclient-jetty/src/main/java/reactivefeign/webclient/jetty/JettyClientHttpConnectorBuilder.java index 3892ca547..797ae8bea 100644 --- a/feign-reactor-webclient-jetty/src/main/java/reactivefeign/webclient/jetty/JettyClientHttpConnectorBuilder.java +++ b/feign-reactor-webclient-jetty/src/main/java/reactivefeign/webclient/jetty/JettyClientHttpConnectorBuilder.java @@ -3,7 +3,7 @@ import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.HttpProxy; import org.eclipse.jetty.http2.client.HTTP2Client; -import org.eclipse.jetty.http2.client.http.HttpClientTransportOverHTTP2; +import org.eclipse.jetty.http2.client.transport.HttpClientTransportOverHTTP2; import org.springframework.http.client.reactive.ClientHttpConnector; import org.springframework.http.client.reactive.JettyClientHttpConnector; import reactivefeign.ReactiveOptions; @@ -39,8 +39,8 @@ public static ClientHttpConnector buildJettyClientHttpConnector(JettyReactiveOpt if(options.getProxySettings() != null){ ReactiveOptions.ProxySettings proxySettings = options.getProxySettings(); - httpClient.getProxyConfiguration().getProxies() - .add(new HttpProxy(proxySettings.getHost(), proxySettings.getPort())); + httpClient.getProxyConfiguration() + .addProxy(new HttpProxy(proxySettings.getHost(), proxySettings.getPort())); } return new JettyClientHttpConnector(httpClient); diff --git a/feign-reactor-webclient-jetty/src/main/java/reactivefeign/webclient/jetty/JettyWebReactiveFeign.java b/feign-reactor-webclient-jetty/src/main/java/reactivefeign/webclient/jetty/JettyWebReactiveFeign.java index 81ee86d5f..753deba9d 100644 --- a/feign-reactor-webclient-jetty/src/main/java/reactivefeign/webclient/jetty/JettyWebReactiveFeign.java +++ b/feign-reactor-webclient-jetty/src/main/java/reactivefeign/webclient/jetty/JettyWebReactiveFeign.java @@ -13,7 +13,7 @@ */ package reactivefeign.webclient.jetty; -import org.eclipse.jetty.client.api.Request; +import org.eclipse.jetty.client.Request; import org.springframework.http.client.reactive.ClientHttpConnector; import org.springframework.web.reactive.function.client.ClientRequest; import org.springframework.web.reactive.function.client.WebClient; diff --git a/feign-reactor-webclient/pom.xml b/feign-reactor-webclient/pom.xml index 0ca1dbd0c..3e0e01155 100644 --- a/feign-reactor-webclient/pom.xml +++ b/feign-reactor-webclient/pom.xml @@ -80,8 +80,8 @@ test - com.github.tomakehurst - wiremock-jre8-standalone + org.wiremock + wiremock-standalone test